Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GaussianProcessTuning/ILNumerics.2.14.4735.573/Native/lapack/ILLapackMKL10.0C.cs @ 12858

Last change on this file since 12858 was 9102, checked in by gkronber, 12 years ago

#1967: ILNumerics source for experimentation

File size: 119.0 KB
Line 
1///
2///    This file is part of ILNumerics Community Edition.
3///
4///    ILNumerics Community Edition - high performance computing for applications.
5///    Copyright (C) 2006 - 2012 Haymo Kutschbach, http://ilnumerics.net
6///
7///    ILNumerics Community Edition is free software: you can redistribute it and/or modify
8///    it under the terms of the GNU General Public License version 3 as published by
9///    the Free Software Foundation.
10///
11///    ILNumerics Community Edition is distributed in the hope that it will be useful,
12///    but WITHOUT ANY WARRANTY; without even the implied warranty of
13///    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14///    GNU General Public License for more details.
15///
16///    You should have received a copy of the GNU General Public License
17///    along with ILNumerics Community Edition. See the file License.txt in the root
18///    of your distribution package. If not, see <http://www.gnu.org/licenses/>.
19///
20///    In addition this software uses the following components and/or licenses:
21///
22///    =================================================================================
23///    The Open Toolkit Library License
24///   
25///    Copyright (c) 2006 - 2009 the Open Toolkit library.
26///   
27///    Permission is hereby granted, free of charge, to any person obtaining a copy
28///    of this software and associated documentation files (the "Software"), to deal
29///    in the Software without restriction, including without limitation the rights to
30///    use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
31///    the Software, and to permit persons to whom the Software is furnished to do
32///    so, subject to the following conditions:
33///
34///    The above copyright notice and this permission notice shall be included in all
35///    copies or substantial portions of the Software.
36///
37///    =================================================================================
38///   
39
40#pragma warning disable 1570, 1591
41using System;
42using System.Collections.Generic;
43using System.Text;
44using ILNumerics.Native;
45using System.Runtime.InteropServices;
46using ILNumerics.Exceptions;
47using System.Security;
48using ILNumerics.Misc;
49
50namespace ILNumerics.Native  {
51    /// <summary>
52    /// Generic LAPACK implementation, unsupported processor types
53    /// </summary>
54    public class ILLapackMKL10_0 : IILLapack {
55
56        #region DLL INCLUDES
57#if x64
58        #region 64 bit includes
59        [DllImport("mkl_custom64", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
60        internal static extern int mkl_domain_set_num_threads(ref int num, ref int mask);
61        [DllImport("mkl_custom64", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
62        internal static extern int mkl_domain_get_max_threads(ref int mask);
63        [DllImport("mkl_custom64", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
64        internal static extern void mkl_set_num_threads(int num);
65        [DllImport("mkl_custom64", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
66        internal static extern void omp_set_num_threads(int num);
67        [DllImport("mkl_custom64", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
68        internal static extern int mkl_get_max_threads();
69        [DllImport("mkl_custom64", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
70        internal static extern void mkl_set_dynamic(ref int boolean_value);
71
72        [DllImport("mkl_custom64", EntryPoint = "ilaenv",CallingConvention = CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
73        private static extern int mkl_ilaenv(ref int ispec, ref string name, ref string opts, ref int n1, ref int n2, ref int n3, ref int n4);
74
75        ///////////////////////////   DOUBLE LAPACK /////////////////////////////////
76        [DllImport("mkl_custom64", EntryPoint = "DGEMM",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
77        private static extern void mkl_dgemm(ref char TransA, ref char TransB, ref int M,ref int N, ref int K, ref  double alpha, IntPtr A, ref int lda, IntPtr B, ref int ldb, ref double beta, double[] C, ref int ldc);
78        [DllImport("mkl_custom64", EntryPoint = "SGEMM",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
79        private static extern void mkl_sgemm(ref char TransA, ref char TransB, ref int M,ref int N, ref int K, ref float alpha, IntPtr A,ref int lda, IntPtr B, ref int ldb, ref float beta,float[] C, ref int ldc);
80        [DllImport("mkl_custom64", EntryPoint = "CGEMM",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
81        private static extern void mkl_cgemm(ref char TransA, ref char TransB, ref int M,ref int N, ref int K, ref fcomplex alpha, IntPtr A, ref int lda, IntPtr B, ref int ldb, ref fcomplex beta,[In,Out] fcomplex [] C, ref int ldc);
82        [DllImport("mkl_custom64", EntryPoint = "ZGEMM",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
83        private static extern void mkl_zgemm(ref char TransA, ref char TransB, ref int M, ref int N, ref int K, ref complex alpha, IntPtr A, ref int lda, IntPtr B, ref int ldb, ref complex beta,[In,Out] complex [] C, ref int ldc);
84
85        [DllImport("mkl_custom64", EntryPoint = "DGESDD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
86        private static extern void mkl_dgesdd(ref char jobz, ref int m, ref int n,double[] a, ref int lda, double[] s,double[] u, ref int ldu, double[] vt,ref int ldvt, double[] work, ref int lwork,int[] iwork, ref int info);
87        [DllImport("mkl_custom64", EntryPoint = "SGESDD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
88        private static extern void mkl_sgesdd(ref char jobz, ref int m, ref int n,float[] a, ref int lda, float[] s,float[] u, ref int ldu, float[] vt, ref int ldvt, float[] work, ref int lwork,int[] iwork, ref int info);
89        [DllImport("mkl_custom64", EntryPoint = "CGESDD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
90        private static extern void mkl_cgesdd(ref char jobz, ref int m, ref int n,[In, Out] fcomplex[] a, ref int lda, float[] s,[In, Out] fcomplex[] u, ref int ldu, [In, Out]  fcomplex[] vt, ref int ldvt, [In, Out] fcomplex[] work, ref int lwork,[In,Out] float[] rwork, int[] iwork, ref int info);
91        [DllImport("mkl_custom64", EntryPoint = "ZGESDD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
92        private static extern void mkl_zgesdd(ref char jobz, ref int m, ref int n,[In, Out] complex[] a, ref int lda, double[] s,[In, Out] complex[] u, ref int ldu, [In, Out] complex[] vt,ref int ldvt, [In, Out] complex[] work, ref int lwork,[In,Out] double[] rwork, int[] iwork, ref int info);
93
94        [DllImport("mkl_custom64", EntryPoint = "DGESVD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
95        private static extern void mkl_dgesvd(ref char jobu, ref  char jobvt, ref int m, ref int n,double[] a, ref int lda, double[] s,double[] u, ref int ldu, double[] vt,ref int ldvt, double[] work, ref int lwork,int[] iwork,ref int info);
96        [DllImport("mkl_custom64", EntryPoint = "SGESVD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
97        private static extern void mkl_sgesvd(ref char jobu, ref  char jobvt, ref int m, ref int n, float[] a, ref int lda, float[] s,float[] u, ref int ldu, float[] vt,ref int ldvt, float[] work, ref int lwork,int[] iwork, ref int info);
98        [DllImport("mkl_custom64", EntryPoint = "CGESVD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
99        private static extern void mkl_cgesvd(ref char jobu, ref  char jobvt, ref int m, ref int n,[In, Out] fcomplex[] a, ref int lda, float[] s,[In, Out] fcomplex[] u, ref int ldu,[In,Out] fcomplex[] vt,ref int ldvt, [In, Out]  fcomplex[] work, ref int lwork,int[] iwork,ref int info);
100        [DllImport("mkl_custom64", EntryPoint = "ZGESVD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
101        private static extern void mkl_zgesvd(ref char jobu, ref  char jobvt, ref int m, ref int n,[In, Out] complex[] a, ref int lda, double[] s,[In, Out] complex[] u, ref int ldu, [In, Out] complex[] vt,ref int ldvt, [In, Out]  complex[] work, ref int lwork,int[] iwork,ref int info);
102
103        [DllImport("mkl_custom64", EntryPoint = "DPOTRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
104        private static extern void mkl_dpotrf (ref char uplo, ref int n, double [] A, ref int lda, ref int info);
105        [DllImport("mkl_custom64", EntryPoint = "SPOTRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
106        private static extern void mkl_spotrf (ref char uplo, ref int n, float [] A, ref int lda, ref int info);
107        [DllImport("mkl_custom64", EntryPoint = "CPOTRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
108        private static extern void mkl_cpotrf (ref char uplo, ref int n,[In,Out] fcomplex [] A, ref int lda, ref int info);
109        [DllImport("mkl_custom64", EntryPoint = "ZPOTRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
110        private static extern void mkl_zpotrf (ref char uplo, ref int n, [In,Out] complex [] A, ref int lda, ref int info);
111       
112        [DllImport("mkl_custom64", EntryPoint = "DPOTRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
113        private static extern void mkl_dpotri (ref char uplo,ref  int n, double [] A, ref int lda, ref int info);
114        [DllImport("mkl_custom64", EntryPoint = "SPOTRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
115        private static extern void mkl_spotri (ref char uplo, ref int n, float [] A, ref int lda, ref int info);
116        [DllImport("mkl_custom64", EntryPoint = "CPOTRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
117        private static extern void mkl_cpotri (ref char uplo, ref int n,[In,Out] fcomplex [] A, ref int lda,ref int info);
118        [DllImport("mkl_custom64", EntryPoint = "ZPOTRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
119        private static extern void mkl_zpotri (ref char uplo, ref int n, [In,Out] complex [] A, ref int lda,ref int info);
120
121        [DllImport("mkl_custom64", EntryPoint = "DPOTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
122        private static extern void mkl_dpotrs (ref char uplo,ref  int n, ref int NRHS, double [] A, ref int lda, double[] B, ref int ldb, ref int info);
123        [DllImport("mkl_custom64", EntryPoint = "SPOTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
124        private static extern void mkl_spotrs (ref char uplo,ref  int n, ref int NRHS, float [] A, ref int lda, float[] B, ref int ldb, ref int info);
125        [DllImport("mkl_custom64", EntryPoint = "CPOTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
126        private static extern void mkl_cpotrs (ref char uplo,ref  int n, ref int NRHS, [In,Out] fcomplex [] A, ref int lda, [In,Out] fcomplex[] B, ref int ldb, ref int info);
127        [DllImport("mkl_custom64", EntryPoint = "ZPOTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
128        private static extern void mkl_zpotrs (ref char uplo,ref  int n, ref int NRHS, [In,Out] complex [] A, ref int lda, [In,Out] complex[] B, ref int ldb, ref int info);
129
130        [DllImport("mkl_custom64", EntryPoint = "DGETRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
131        private static extern void mkl_dgetrf (ref int M, ref int N, double [] A, ref int LDA, int[] IPIV, ref int info);
132        [DllImport("mkl_custom64", EntryPoint = "SGETRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
133        private static extern void mkl_sgetrf (ref int M, ref int N, float[] A, ref int LDA, int [] IPIV, ref int info);
134        [DllImport("mkl_custom64", EntryPoint = "CGETRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
135        private static extern void mkl_cgetrf (ref int M, ref int N, [In,Out] fcomplex [] A, ref int LDA, int [] IPIV, ref int info);
136        [DllImport("mkl_custom64", EntryPoint = "ZGETRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
137        private static extern void mkl_zgetrf (ref int M, ref int N, [In,Out] complex [] A, ref int LDA, int [] IPIV, ref int info);
138
139        [DllImport("mkl_custom64", EntryPoint = "DGETRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
140        private static extern void mkl_dgetri (ref int N, double[] A,ref  int LDA, int[] IPIV, double[] work, ref int lwork, ref int info);
141        [DllImport("mkl_custom64", EntryPoint = "SGETRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
142        private static extern void mkl_sgetri (ref int N, float [] A, ref int LDA, int [] IPIV, float[] work, ref int lwork, ref int info);
143        [DllImport("mkl_custom64", EntryPoint = "CGETRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
144        private static extern void mkl_cgetri (ref int N, [In,Out] fcomplex [] A, ref int LDA,[In,Out] int [] IPIV, [In,Out] fcomplex[] work, ref int lwork, ref int info);
145        [DllImport("mkl_custom64", EntryPoint = "ZGETRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
146        private static extern void mkl_zgetri (ref int N, [In,Out] complex [] A, ref int LDA, int [] IPIV, [In,Out] complex[] work, ref int lwork, ref int info);
147
148        [DllImport("mkl_custom64", EntryPoint = "DGEQRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
149        private static extern void mkl_dgeqrf (ref int M, ref int N, double [] A, ref int lda, double [] tau, double[] work, ref int lwork, ref int info);
150        [DllImport("mkl_custom64", EntryPoint = "SGEQRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
151        private static extern void mkl_sgeqrf (ref int M, ref int N, float [] A, ref int lda, float [] tau, float[] work, ref int lwork,  ref int info);
152        [DllImport("mkl_custom64", EntryPoint = "CGEQRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
153        private static extern void mkl_cgeqrf (ref int M, ref int N, [In,Out] fcomplex [] A, ref int lda, [In,Out] fcomplex [] tau, [In,Out] fcomplex[] work, ref int lwork, ref int info);
154        [DllImport("mkl_custom64", EntryPoint = "ZGEQRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
155        private static extern void mkl_zgeqrf (ref int M, ref int N, [In,Out] complex [] A, ref int lda, [In,Out] complex [] tau, [In,Out] complex[] work, ref int lwork,  ref int info);
156
157        [DllImport("mkl_custom64", EntryPoint = "DGEQP3",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
158        private static extern void mkl_dgeqp3 (ref int M, ref int N, double [] A, ref int LDA, int [] JPVT, double [] tau, double [] work, ref int lwork, ref int info );
159        [DllImport("mkl_custom64", EntryPoint = "SGEQP3",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
160        private static extern void mkl_sgeqp3 (ref int M, ref int N, float [] A, ref int LDA, int [] JPVT, float [] tau, float [] work, ref int lwork, ref int info );
161        [DllImport("mkl_custom64", EntryPoint = "CGEQP3",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
162        private static extern void mkl_cgeqp3 (ref int M, ref int N,[In,Out] fcomplex [] A, ref int LDA,[In,Out] int [] JPVT, [In,Out] fcomplex [] tau, [In,Out] fcomplex [] work, ref int lwork,[In,Out] float [] rwork, ref int info );
163        [DllImport("mkl_custom64", EntryPoint = "ZGEQP3",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
164        private static extern void mkl_zgeqp3 (ref int M, ref int N, [In,Out] complex [] A, ref int LDA, [In,Out] int [] JPVT, [In,Out] complex [] tau, [In,Out] complex [] work, ref int lwork, [In,Out] double [] rwork, ref int info );
165
166        [DllImport("mkl_custom64", EntryPoint = "DORMQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
167        private static extern void mkl_dormqr (ref char side, ref char trans, ref int m, ref int n, ref int k, double[] A, int lda, double[] tau, double[] C, ref int ldc, ref int info);
168        [DllImport("mkl_custom64", EntryPoint = "SORMQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
169        private static extern void mkl_sormqr (ref char side, ref char trans, ref int m, ref int n, ref int k, float [] A, ref int lda, float [] tau , float [] C, ref int ldc, ref int info);
170       
171        [DllImport("mkl_custom64", EntryPoint = "DORGQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
172        private static extern void mkl_dorgqr (ref int m, ref int n, ref int k, double[] A,ref int lda, double[] tau, double[] work, ref int lwork, ref int info);
173        [DllImport("mkl_custom64", EntryPoint = "SORGQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
174        private static extern void mkl_sorgqr (ref int m, ref int n, ref int k, float [] A, ref int lda, float [] tau , float[] work, ref int lwork,  ref int info);
175        [DllImport("mkl_custom64", EntryPoint = "CUNGQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
176        private static extern void mkl_cungqr (ref int m, ref int n, ref int k, [In,Out] fcomplex[] A,ref int lda, [In,Out] fcomplex[] tau, [In,Out] fcomplex[] work, ref int lwork, ref int info);
177        [DllImport("mkl_custom64", EntryPoint = "ZUNGQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
178        private static extern void mkl_zungqr (ref int m, ref int n, ref int k, [In,Out] complex[] A,ref int lda, [In,Out] complex[] tau, [In,Out] complex[] work, ref int lwork, ref int info);
179       
180        [DllImport("mkl_custom64", EntryPoint = "DTRTRS", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
181        private static extern void mkl_dtrtrs (ref char uplo, ref char transA, ref char diag, ref int N, ref int nrhs, IntPtr A, ref int LDA, IntPtr B, ref int LDB, ref int info);
182        [DllImport("mkl_custom64", EntryPoint = "STRTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
183        private static extern void mkl_strtrs (ref char uplo, ref char transA, ref char diag, ref int N, ref int nrhs, IntPtr A, ref int LDA, IntPtr B, ref int LDB, ref int info);
184        [DllImport("mkl_custom64", EntryPoint = "CTRTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
185        private static extern void mkl_ctrtrs (ref char uplo, ref char transA, ref char diag, ref int N, ref int nrhs, IntPtr A, ref int LDA, IntPtr B, ref int LDB, ref int info);
186        [DllImport("mkl_custom64", EntryPoint = "ZTRTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
187        private static extern void mkl_ztrtrs (ref char uplo, ref char transA, ref char diag, ref int N, ref int nrhs, IntPtr A, ref int LDA, IntPtr B, ref int LDB, ref int info);
188       
189        [DllImport("mkl_custom64", EntryPoint = "DGETRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
190        private static extern void mkl_dgetrs(ref char trans, ref int N, ref int NRHS, double[] A, ref int LDA, int[] IPIV, double[] B, ref int LDB, ref int info);
191        [DllImport("mkl_custom64", EntryPoint = "SGETRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
192        private static extern void mkl_sgetrs(ref char trans, ref int N, ref int NRHS, float[] A, ref int LDA, int[] IPIV, float[] B, ref int LDB, ref int info);
193        [DllImport("mkl_custom64", EntryPoint = "CGETRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
194        private static extern void mkl_cgetrs(ref char trans, ref int N, ref int NRHS, [In,Out] fcomplex[] A, ref int LDA, int[] IPIV, [In,Out] fcomplex[] B, ref int LDB, ref int info);
195        [DllImport("mkl_custom64", EntryPoint = "ZGETRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
196        private static extern void mkl_zgetrs(ref char trans, ref int N, ref int NRHS, [In,Out] complex[] A, ref int LDA, int[] IPIV, [In,Out] complex[] B, ref int LDB, ref int info);
197
198        [DllImport("mkl_custom64", EntryPoint = "DGELSD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
199        private static extern void mkl_dgelsd (ref int m,ref int n,ref int nrhs, double[] A,ref int lda, double[] B,ref int ldb, double[] S, ref double RCond, ref int rank, double[] work,ref int lwork, int[] iwork, ref int info);
200        [DllImport("mkl_custom64", EntryPoint = "SGELSD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
201        private static extern void mkl_sgelsd (ref int m,ref int n,ref int nrhs, float[] A,ref int lda, float[] B,ref int ldb, float[] S, ref float RCond, ref int rank, float[] work,ref int lwork, int[] iwork, ref int info);
202        [DllImport("mkl_custom64", EntryPoint = "CGELSD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
203        private static extern void mkl_cgelsd (ref int m,ref int n,ref int nrhs, [In,Out] fcomplex[] A,ref int lda, [In,Out] fcomplex[] B,ref int ldb, float[] S , ref float RCond, ref int rank, [In,Out] fcomplex[] work, ref int lwork, float[] rwork, int[] iwork, ref int info);
204        [DllImport("mkl_custom64", EntryPoint = "ZGELSD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
205        private static extern void mkl_zgelsd (ref int m,ref int n,ref int nrhs, [In,Out] complex[] A,ref int lda, [In,Out] complex[] B,ref int ldb, double[] S, ref double RCond, ref int rank, [In,Out]  complex[] work,ref int lwork, double[] rwork, int[] iwork, ref int info);
206       
207        [DllImport("mkl_custom64", EntryPoint = "DGELSY",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
208        private static extern void mkl_dgelsy (ref int m,ref int n,ref int nrhs, double[] A,ref int lda, double[] B,ref int ldb, int[] JPVT0, ref double RCond, ref int rank, double[] work, ref int lwork, ref int info);
209        [DllImport("mkl_custom64", EntryPoint = "SGELSY",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
210        private static extern void mkl_sgelsy (ref int m,ref int n,ref int nrhs, float[] A,ref int lda, float[] B,ref int ldb, int[] JPVT0, ref float RCond, ref int rank, float[] work,ref int lwork, ref int info);
211        [DllImport("mkl_custom64", EntryPoint = "CGELSY",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
212        private static extern void mkl_cgelsy (ref int m,ref int n,ref int nrhs, [In,Out] fcomplex[] A,ref int lda, [In,Out] fcomplex[] B,ref int ldb, int[] JPVT0, ref float RCond, ref int rank, [In,Out] fcomplex[] work, ref int lwork, float[] rwork, ref int info);
213        [DllImport("mkl_custom64", EntryPoint = "ZGELSY",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
214        private static extern void mkl_zgelsy (ref int m,ref int n,ref int nrhs, [In,Out] complex[] A,ref int lda, [In,Out] complex[] B,ref int ldb, int[] JPVT0, ref double RCond, ref int rank, [In,Out]  complex[] work, ref int lwork, double[] rwork, ref int info);
215       
216        [DllImport("mkl_custom64", EntryPoint = "DGEEVX",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
217        private static extern void mkl_dgeevx (ref char balance, ref char jobvl, ref char jobvr, ref char sense, ref int n,            double[] A, ref int lda,          double[] wr, double[] wi, double[] vl, ref int ldvl,            double[] vr, ref int ldvr, ref int ilo, ref int ihi, double[] scale, ref double abnrm, double[] rconde, double[] rcondv, double[] work, ref int lwork, int [] iwork, ref int info);
218        [DllImport("mkl_custom64", EntryPoint = "SGEEVX",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]       
219        private static extern void mkl_sgeevx (ref char balance, ref char jobvl, ref char jobvr, ref char sense, ref int n,             float[] A, ref int lda,             float[] wr, float[] wi, float[] vl, ref int ldvl,             float[] vr, ref int ldvr, ref int ilo, ref int ihi, float[]  scale, ref float  abnrm, float[]  rconde, float[]  rcondv, float [] work, ref int lwork, int [] iwork, ref int info);
220        [DllImport("mkl_custom64", EntryPoint = "CGEEVX",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]       
221        private static extern void mkl_cgeevx (ref char balance, ref char jobvl, ref char jobvr, ref char sense, ref int n, [In,Out] fcomplex[] A, ref int lda, [In,Out] fcomplex[] w,  [In,Out] fcomplex[] vl, ref int ldvl, [In,Out] fcomplex[] vr, ref int ldvr, ref int ilo, ref int ihi, float[]  scale, ref float  abnrm, float[]  rconde, float[]  rcondv, [In,Out] fcomplex[] work, ref int lwork, float[] rwork, ref int info);
222        [DllImport("mkl_custom64", EntryPoint = "ZGEEVX",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]       
223        private static extern void mkl_zgeevx (ref char balance, ref char jobvl, ref char jobvr, ref char sense, ref int n, [In,Out]  complex[] A, ref int lda, [In,Out] complex[]  w,   [In,Out] complex[] vl, ref int ldvl, [In,Out]  complex[] vr, ref int ldvr, ref int ilo, ref int ihi, double[] scale, ref double abnrm, double[] rconde, double[] rcondv, [In,Out] complex[] work, ref int lwork, double[] rwork, ref int info);
224
225        [DllImport("mkl_custom64", EntryPoint = "DSYEVR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
226        private static extern void mkl_dsyevr (ref char jobz, ref char range, ref char uplo, ref int n,          double  [] A, ref int lda, ref double vl, ref double vu, ref int il, ref int iu, ref double abstol, ref int m, double[] w,          double  [] z, ref int ldz, int[] isuppz, double[] work, ref int lwork, int[] iwork, ref int liwork, ref int info);
227        //[DllImport("mkl_custom64", EntryPoint = "DSYEVR",CallingConvention =CallingConvention.Cdecl)]
228        //private static extern void mkl_dsyevr (ref char jobz, ref char range, ref char uplo, ref int n,          double  [] A, ref int lda, ref double vl, ref double vu, ref int il, ref int iu, ref double abstol, ref int m, double[] w,          double  [] z, ref int ldz, int[] isuppz, double[] work, ref int lwork, int[] iwork, ref int liwork, ref int info);
229        [DllImport("mkl_custom64", EntryPoint = "SSYEVR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
230        private static extern void mkl_ssyevr (ref char jobz, ref char range, ref char uplo, ref int n,          float   [] A, ref int lda, ref float  vl, ref float  vu, ref int il, ref int iu, ref float  abstol, ref int m, float [] w,          float   [] z, ref int ldz, int[] isuppz, float [] work, ref int lwork, int[] iwork, ref int liwork, ref int info);
231        [DllImport("mkl_custom64", EntryPoint = "CHEEVR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
232        private static extern void mkl_cheevr (ref char jobz, ref char range, ref char uplo, ref int n, [In,Out] fcomplex[] A, ref int lda, ref float  vl, ref float  vu, ref int il, ref int iu, ref float  abstol, ref int m, float [] w, [In,Out] fcomplex[] z, ref int ldz, int[] isuppz, [In,Out] fcomplex[] work, ref int lwork, float[] rwork, ref int lrwork, int[] iwork, ref int liwork, ref int info);
233        [DllImport("mkl_custom64", EntryPoint = "ZHEEVR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
234        private static extern void mkl_zheevr (ref char jobz, ref char range, ref char uplo, ref int n, [In,Out] complex [] A, ref int lda, ref double vl, ref double vu, ref int il, ref int iu, ref double abstol, ref int m, double[] w, [In,Out] complex [] z, ref int ldz, int[] isuppz, [In,Out] complex[] work, ref int lwork, double[] rwork, ref int lrwork, int[] iwork, ref int liwork, ref int info);
235
236        [DllImport("mkl_custom64", EntryPoint = "DSYGV",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
237        private static extern void mkl_dsygv (ref int itype, ref char jobz, ref char uplo, ref int n, double  [] A, ref int lda, double  [] B, ref int ldb, double [] w, double [] work, ref int lwork, ref int info);
238        [DllImport("mkl_custom64", EntryPoint = "SSYGV",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
239        private static extern void mkl_ssygv (ref int itype, ref char jobz, ref char uplo, ref int n, float   [] A, ref int lda, float   [] B, ref int ldb, float [] w,  float  [] work, ref int lwork, ref int info);
240        [DllImport("mkl_custom64", EntryPoint = "CHEGV",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
241        private static extern void mkl_chegv (ref int itype, ref char jobz, ref char uplo, ref int n, [In,Out] fcomplex[] A, ref int lda, [In,Out] fcomplex [] B, ref int ldb, float  [] w, [In,Out] fcomplex[] work , ref int lwork, float[] rwork, ref int info);
242        [DllImport("mkl_custom64", EntryPoint = "ZHEGV",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
243        private static extern void mkl_zhegv (ref int itype, ref char jobz, ref char uplo, ref int n, [In,Out] complex [] A, ref int lda, [In,Out] complex  [] B, ref int ldb, double [] w, [In,Out]  complex[] work , ref int lwork, double[] rwork, ref int info);
244        #endregion
245#else
246        #region 32 bit includes
247        [DllImport("mkl_custom32", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
248        internal static extern int mkl_domain_set_num_threads(ref int num, ref int mask);
249        [DllImport("mkl_custom32", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
250        internal static extern int mkl_domain_get_max_threads(ref int mask);
251        [DllImport("mkl_custom32", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
252        internal static extern void mkl_set_num_threads(int num);
253        [DllImport("mkl_custom32", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
254        internal static extern void omp_set_num_threads(int num);
255        [DllImport("mkl_custom32", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
256        internal static extern int mkl_get_max_threads();
257        [DllImport("mkl_custom32", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
258        internal static extern void mkl_set_dynamic(ref int boolean_value);
259
260        [DllImport("mkl_custom32", EntryPoint = "ilaenv",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
261        private static extern int mkl_ilaenv(ref int ispec, ref string name, ref string opts, ref int n1, ref int n2, ref int n3, ref int n4);
262
263        ///////////////////////////   DOUBLE LAPACK /////////////////////////////////
264        [DllImport("mkl_custom32", EntryPoint = "DGEMM",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
265        private static extern void mkl_dgemm(ref char TransA, ref char TransB, ref int M,ref int N, ref int K, ref  double alpha, IntPtr A, ref int lda, IntPtr B, ref int ldb, ref double beta, double[] C, ref int ldc);
266        [DllImport("mkl_custom32", EntryPoint = "SGEMM",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
267        private static extern void mkl_sgemm(ref char TransA, ref char TransB, ref int M,ref int N, ref int K, ref float alpha, IntPtr A,ref int lda, IntPtr B, ref int ldb, ref float beta,float[] C, ref int ldc);
268        [DllImport("mkl_custom32", EntryPoint = "CGEMM",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
269        private static extern void mkl_cgemm(ref char TransA, ref char TransB, ref int M,ref int N, ref int K, ref fcomplex alpha, IntPtr A, ref int lda, IntPtr B, ref int ldb, ref fcomplex beta,[In,Out] fcomplex [] C, ref int ldc);
270        [DllImport("mkl_custom32", EntryPoint = "ZGEMM",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
271        private static extern void mkl_zgemm(ref char TransA, ref char TransB, ref int M, ref int N, ref int K, ref complex alpha, IntPtr A, ref int lda, IntPtr B, ref int ldb, ref complex beta,[In,Out] complex [] C, ref int ldc);
272
273        [DllImport("mkl_custom32", EntryPoint = "DGESDD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
274        private static extern void mkl_dgesdd(ref char jobz, ref int m, ref int n,double[] a, ref int lda, double[] s,double[] u, ref int ldu, double[] vt,ref int ldvt, double[] work, ref int lwork,int[] iwork, ref int info);
275        [DllImport("mkl_custom32", EntryPoint = "SGESDD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
276        private static extern void mkl_sgesdd(ref char jobz, ref int m, ref int n,float[] a, ref int lda, float[] s,float[] u, ref int ldu, float[] vt, ref int ldvt, float[] work, ref int lwork,int[] iwork, ref int info);
277        [DllImport("mkl_custom32", EntryPoint = "CGESDD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
278        private static extern void mkl_cgesdd(ref char jobz, ref int m, ref int n,[In, Out] fcomplex[] a, ref int lda, float[] s,[In, Out] fcomplex[] u, ref int ldu, [In, Out]  fcomplex[] vt, ref int ldvt, [In, Out] fcomplex[] work, ref int lwork,[In,Out] float[] rwork, int[] iwork, ref int info);
279        [DllImport("mkl_custom32", EntryPoint = "ZGESDD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
280        private static extern void mkl_zgesdd(ref char jobz, ref int m, ref int n,[In, Out] complex[] a, ref int lda, double[] s,[In, Out] complex[] u, ref int ldu, [In, Out] complex[] vt,ref int ldvt, [In, Out] complex[] work, ref int lwork,[In,Out] double[] rwork, int[] iwork, ref int info);
281
282        [DllImport("mkl_custom32", EntryPoint = "DGESVD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
283        private static extern void mkl_dgesvd(ref char jobu, ref  char jobvt, ref int m, ref int n,double[] a, ref int lda, double[] s,double[] u, ref int ldu, double[] vt,ref int ldvt, double[] work, ref int lwork,int[] iwork,ref int info);
284        [DllImport("mkl_custom32", EntryPoint = "SGESVD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
285        private static extern void mkl_sgesvd(ref char jobu, ref  char jobvt, ref int m, ref int n, float[] a, ref int lda, float[] s,float[] u, ref int ldu, float[] vt,ref int ldvt, float[] work, ref int lwork,int[] iwork, ref int info);
286        [DllImport("mkl_custom32", EntryPoint = "CGESVD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
287        private static extern void mkl_cgesvd(ref char jobu, ref  char jobvt, ref int m, ref int n,[In, Out] fcomplex[] a, ref int lda, float[] s,[In, Out] fcomplex[] u, ref int ldu,[In,Out] fcomplex[] vt,ref int ldvt, [In, Out]  fcomplex[] work, ref int lwork,int[] iwork,ref int info);
288        [DllImport("mkl_custom32", EntryPoint = "ZGESVD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
289        private static extern void mkl_zgesvd(ref char jobu, ref  char jobvt, ref int m, ref int n,[In, Out] complex[] a, ref int lda, double[] s,[In, Out] complex[] u, ref int ldu, [In, Out] complex[] vt,ref int ldvt, [In, Out]  complex[] work, ref int lwork,int[] iwork,ref int info);
290
291        [DllImport("mkl_custom32", EntryPoint = "DPOTRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
292        private static extern void mkl_dpotrf (ref char uplo, ref int n, double [] A, ref int lda, ref int info);
293        [DllImport("mkl_custom32", EntryPoint = "SPOTRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
294        private static extern void mkl_spotrf (ref char uplo, ref int n, float [] A, ref int lda, ref int info);
295        [DllImport("mkl_custom32", EntryPoint = "CPOTRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
296        private static extern void mkl_cpotrf (ref char uplo, ref int n,[In,Out] fcomplex [] A, ref int lda, ref int info);
297        [DllImport("mkl_custom32", EntryPoint = "ZPOTRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
298        private static extern void mkl_zpotrf (ref char uplo, ref int n, [In,Out] complex [] A, ref int lda, ref int info);
299       
300        [DllImport("mkl_custom32", EntryPoint = "DPOTRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
301        private static extern void mkl_dpotri (ref char uplo,ref  int n, double [] A, ref int lda, ref int info);
302        [DllImport("mkl_custom32", EntryPoint = "SPOTRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
303        private static extern void mkl_spotri (ref char uplo, ref int n, float [] A, ref int lda, ref int info);
304        [DllImport("mkl_custom32", EntryPoint = "CPOTRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
305        private static extern void mkl_cpotri (ref char uplo, ref int n,[In,Out] fcomplex [] A, ref int lda,ref int info);
306        [DllImport("mkl_custom32", EntryPoint = "ZPOTRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
307        private static extern void mkl_zpotri (ref char uplo, ref int n, [In,Out] complex [] A, ref int lda,ref int info);
308
309        [DllImport("mkl_custom32", EntryPoint = "DPOTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
310        private static extern void mkl_dpotrs (ref char uplo,ref  int n, ref int NRHS, double [] A, ref int lda, double[] B, ref int ldb, ref int info);
311        [DllImport("mkl_custom32", EntryPoint = "SPOTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
312        private static extern void mkl_spotrs (ref char uplo,ref  int n, ref int NRHS, float [] A, ref int lda, float[] B, ref int ldb, ref int info);
313        [DllImport("mkl_custom32", EntryPoint = "CPOTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
314        private static extern void mkl_cpotrs (ref char uplo,ref  int n, ref int NRHS, [In,Out] fcomplex [] A, ref int lda, [In,Out] fcomplex[] B, ref int ldb, ref int info);
315        [DllImport("mkl_custom32", EntryPoint = "ZPOTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
316        private static extern void mkl_zpotrs (ref char uplo,ref  int n, ref int NRHS, [In,Out] complex [] A, ref int lda, [In,Out] complex[] B, ref int ldb, ref int info);
317
318        [DllImport("mkl_custom32", EntryPoint = "DGETRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
319        private static extern void mkl_dgetrf (ref int M, ref int N, double [] A, ref int LDA, int[] IPIV, ref int info);
320        [DllImport("mkl_custom32", EntryPoint = "SGETRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
321        private static extern void mkl_sgetrf (ref int M, ref int N, float[] A, ref int LDA, int [] IPIV, ref int info);
322        [DllImport("mkl_custom32", EntryPoint = "CGETRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
323        private static extern void mkl_cgetrf (ref int M, ref int N, [In,Out] fcomplex [] A, ref int LDA, int [] IPIV, ref int info);
324        [DllImport("mkl_custom32", EntryPoint = "ZGETRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
325        private static extern void mkl_zgetrf (ref int M, ref int N, [In,Out] complex [] A, ref int LDA, int [] IPIV, ref int info);
326
327        [DllImport("mkl_custom32", EntryPoint = "DGETRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
328        private static extern void mkl_dgetri (ref int N, double[] A,ref  int LDA, int[] IPIV, double[] work, ref int lwork, ref int info);
329        [DllImport("mkl_custom32", EntryPoint = "SGETRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
330        private static extern void mkl_sgetri (ref int N, float [] A, ref int LDA, int [] IPIV, float[] work, ref int lwork, ref int info);
331        [DllImport("mkl_custom32", EntryPoint = "CGETRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
332        private static extern void mkl_cgetri (ref int N, [In,Out] fcomplex [] A, ref int LDA,[In,Out] int [] IPIV, [In,Out] fcomplex[] work, ref int lwork, ref int info);
333        [DllImport("mkl_custom32", EntryPoint = "ZGETRI",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
334        private static extern void mkl_zgetri (ref int N, [In,Out] complex [] A, ref int LDA, int [] IPIV, [In,Out] complex[] work, ref int lwork, ref int info);
335
336        [DllImport("mkl_custom32", EntryPoint = "DGEQRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
337        private static extern void mkl_dgeqrf (ref int M, ref int N, double [] A, ref int lda, double [] tau, double[] work, ref int lwork, ref int info);
338        [DllImport("mkl_custom32", EntryPoint = "SGEQRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
339        private static extern void mkl_sgeqrf (ref int M, ref int N, float [] A, ref int lda, float [] tau, float[] work, ref int lwork,  ref int info);
340        [DllImport("mkl_custom32", EntryPoint = "CGEQRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
341        private static extern void mkl_cgeqrf (ref int M, ref int N, [In,Out] fcomplex [] A, ref int lda, [In,Out] fcomplex [] tau, [In,Out] fcomplex[] work, ref int lwork, ref int info);
342        [DllImport("mkl_custom32", EntryPoint = "ZGEQRF",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
343        private static extern void mkl_zgeqrf (ref int M, ref int N, [In,Out] complex [] A, ref int lda, [In,Out] complex [] tau, [In,Out] complex[] work, ref int lwork,  ref int info);
344
345        [DllImport("mkl_custom32", EntryPoint = "DGEQP3",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
346        private static extern void mkl_dgeqp3 (ref int M, ref int N, double [] A, ref int LDA, int [] JPVT, double [] tau, double [] work, ref int lwork, ref int info );
347        [DllImport("mkl_custom32", EntryPoint = "SGEQP3",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
348        private static extern void mkl_sgeqp3 (ref int M, ref int N, float [] A, ref int LDA, int [] JPVT, float [] tau, float [] work, ref int lwork, ref int info );
349        [DllImport("mkl_custom32", EntryPoint = "CGEQP3",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
350        private static extern void mkl_cgeqp3 (ref int M, ref int N,[In,Out] fcomplex [] A, ref int LDA,[In,Out] int [] JPVT, [In,Out] fcomplex [] tau, [In,Out] fcomplex [] work, ref int lwork,[In,Out] float [] rwork, ref int info );
351        [DllImport("mkl_custom32", EntryPoint = "ZGEQP3",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
352        private static extern void mkl_zgeqp3 (ref int M, ref int N, [In,Out] complex [] A, ref int LDA, [In,Out] int [] JPVT, [In,Out] complex [] tau, [In,Out] complex [] work, ref int lwork, [In,Out] double [] rwork, ref int info );
353
354        [DllImport("mkl_custom32", EntryPoint = "DORMQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
355        private static extern void mkl_dormqr (ref char side, ref char trans, ref int m, ref int n, ref int k, double[] A, int lda, double[] tau, double[] C, ref int ldc, ref int info);
356        [DllImport("mkl_custom32", EntryPoint = "SORMQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
357        private static extern void mkl_sormqr (ref char side, ref char trans, ref int m, ref int n, ref int k, float [] A, ref int lda, float [] tau , float [] C, ref int ldc, ref int info);
358       
359        [DllImport("mkl_custom32", EntryPoint = "DORGQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
360        private static extern void mkl_dorgqr (ref int m, ref int n, ref int k, double[] A,ref int lda, double[] tau, double[] work, ref int lwork, ref int info);
361        [DllImport("mkl_custom32", EntryPoint = "SORGQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
362        private static extern void mkl_sorgqr (ref int m, ref int n, ref int k, float [] A, ref int lda, float [] tau , float[] work, ref int lwork,  ref int info);
363        [DllImport("mkl_custom32", EntryPoint = "CUNGQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
364        private static extern void mkl_cungqr (ref int m, ref int n, ref int k, [In,Out] fcomplex[] A,ref int lda, [In,Out] fcomplex[] tau, [In,Out] fcomplex[] work, ref int lwork, ref int info);
365        [DllImport("mkl_custom32", EntryPoint = "ZUNGQR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
366        private static extern void mkl_zungqr (ref int m, ref int n, ref int k, [In,Out] complex[] A,ref int lda, [In,Out] complex[] tau, [In,Out] complex[] work, ref int lwork, ref int info);
367       
368        [DllImport("mkl_custom32", EntryPoint = "DTRTRS", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
369        private static extern void mkl_dtrtrs (ref char uplo, ref char transA, ref char diag, ref int N, ref int nrhs, IntPtr A, ref int LDA, IntPtr B, ref int LDB, ref int info);
370        [DllImport("mkl_custom32", EntryPoint = "STRTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
371        private static extern void mkl_strtrs (ref char uplo, ref char transA, ref char diag, ref int N, ref int nrhs, IntPtr A, ref int LDA, IntPtr B, ref int LDB, ref int info);
372        [DllImport("mkl_custom32", EntryPoint = "CTRTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
373        private static extern void mkl_ctrtrs (ref char uplo, ref char transA, ref char diag, ref int N, ref int nrhs, IntPtr A, ref int LDA, IntPtr B, ref int LDB, ref int info);
374        [DllImport("mkl_custom32", EntryPoint = "ZTRTRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
375        private static extern void mkl_ztrtrs (ref char uplo, ref char transA, ref char diag, ref int N, ref int nrhs, IntPtr A, ref int LDA, IntPtr B, ref int LDB, ref int info);
376       
377        [DllImport("mkl_custom32", EntryPoint = "DGETRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
378        private static extern void mkl_dgetrs(ref char trans, ref int N, ref int NRHS, double[] A, ref int LDA, int[] IPIV, double[] B, ref int LDB, ref int info);
379        [DllImport("mkl_custom32", EntryPoint = "SGETRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
380        private static extern void mkl_sgetrs(ref char trans, ref int N, ref int NRHS, float[] A, ref int LDA, int[] IPIV, float[] B, ref int LDB, ref int info);
381        [DllImport("mkl_custom32", EntryPoint = "CGETRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
382        private static extern void mkl_cgetrs(ref char trans, ref int N, ref int NRHS, [In,Out] fcomplex[] A, ref int LDA, int[] IPIV, [In,Out] fcomplex[] B, ref int LDB, ref int info);
383        [DllImport("mkl_custom32", EntryPoint = "ZGETRS",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
384        private static extern void mkl_zgetrs(ref char trans, ref int N, ref int NRHS, [In,Out] complex[] A, ref int LDA, int[] IPIV, [In,Out] complex[] B, ref int LDB, ref int info);
385
386        [DllImport("mkl_custom32", EntryPoint = "DGELSD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
387        private static extern void mkl_dgelsd (ref int m,ref int n,ref int nrhs, double[] A,ref int lda, double[] B,ref int ldb, double[] S, ref double RCond, ref int rank, double[] work,ref int lwork, int[] iwork, ref int info);
388        [DllImport("mkl_custom32", EntryPoint = "SGELSD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
389        private static extern void mkl_sgelsd (ref int m,ref int n,ref int nrhs, float[] A,ref int lda, float[] B,ref int ldb, float[] S, ref float RCond, ref int rank, float[] work,ref int lwork, int[] iwork, ref int info);
390        [DllImport("mkl_custom32", EntryPoint = "CGELSD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
391        private static extern void mkl_cgelsd (ref int m,ref int n,ref int nrhs, [In,Out] fcomplex[] A,ref int lda, [In,Out] fcomplex[] B,ref int ldb, float[] S , ref float RCond, ref int rank, [In,Out] fcomplex[] work, ref int lwork, float[] rwork, int[] iwork, ref int info);
392        [DllImport("mkl_custom32", EntryPoint = "ZGELSD",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
393        private static extern void mkl_zgelsd (ref int m,ref int n,ref int nrhs, [In,Out] complex[] A,ref int lda, [In,Out] complex[] B,ref int ldb, double[] S, ref double RCond, ref int rank, [In,Out]  complex[] work,ref int lwork, double[] rwork, int[] iwork, ref int info);
394       
395        [DllImport("mkl_custom32", EntryPoint = "DGELSY",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
396        private static extern void mkl_dgelsy (ref int m,ref int n,ref int nrhs, double[] A,ref int lda, double[] B,ref int ldb, int[] JPVT0, ref double RCond, ref int rank, double[] work, ref int lwork, ref int info);
397        [DllImport("mkl_custom32", EntryPoint = "SGELSY",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
398        private static extern void mkl_sgelsy (ref int m,ref int n,ref int nrhs, float[] A,ref int lda, float[] B,ref int ldb, int[] JPVT0, ref float RCond, ref int rank, float[] work,ref int lwork, ref int info);
399        [DllImport("mkl_custom32", EntryPoint = "CGELSY",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
400        private static extern void mkl_cgelsy (ref int m,ref int n,ref int nrhs, [In,Out] fcomplex[] A,ref int lda, [In,Out] fcomplex[] B,ref int ldb, int[] JPVT0, ref float RCond, ref int rank, [In,Out] fcomplex[] work, ref int lwork, float[] rwork, ref int info);
401        [DllImport("mkl_custom32", EntryPoint = "ZGELSY",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
402        private static extern void mkl_zgelsy (ref int m,ref int n,ref int nrhs, [In,Out] complex[] A,ref int lda, [In,Out] complex[] B,ref int ldb, int[] JPVT0, ref double RCond, ref int rank, [In,Out]  complex[] work, ref int lwork, double[] rwork, ref int info);
403       
404        [DllImport("mkl_custom32", EntryPoint = "DGEEVX",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
405        private static extern void mkl_dgeevx (ref char balance, ref char jobvl, ref char jobvr, ref char sense, ref int n,            double[] A, ref int lda,          double[] wr, double[] wi, double[] vl, ref int ldvl,            double[] vr, ref int ldvr, ref int ilo, ref int ihi, double[] scale, ref double abnrm, double[] rconde, double[] rcondv, double[] work, ref int lwork, int [] iwork, ref int info);
406        [DllImport("mkl_custom32", EntryPoint = "SGEEVX",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]       
407        private static extern void mkl_sgeevx (ref char balance, ref char jobvl, ref char jobvr, ref char sense, ref int n,             float[] A, ref int lda,             float[] wr, float[] wi, float[] vl, ref int ldvl,             float[] vr, ref int ldvr, ref int ilo, ref int ihi, float[]  scale, ref float  abnrm, float[]  rconde, float[]  rcondv, float [] work, ref int lwork, int [] iwork, ref int info);
408        [DllImport("mkl_custom32", EntryPoint = "CGEEVX",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]       
409        private static extern void mkl_cgeevx (ref char balance, ref char jobvl, ref char jobvr, ref char sense, ref int n, [In,Out] fcomplex[] A, ref int lda, [In,Out] fcomplex[] w,  [In,Out] fcomplex[] vl, ref int ldvl, [In,Out] fcomplex[] vr, ref int ldvr, ref int ilo, ref int ihi, float[]  scale, ref float  abnrm, float[]  rconde, float[]  rcondv, [In,Out] fcomplex[] work, ref int lwork, float[] rwork, ref int info);
410        [DllImport("mkl_custom32", EntryPoint = "ZGEEVX",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]       
411        private static extern void mkl_zgeevx (ref char balance, ref char jobvl, ref char jobvr, ref char sense, ref int n, [In,Out]  complex[] A, ref int lda, [In,Out] complex[]  w,   [In,Out] complex[] vl, ref int ldvl, [In,Out]  complex[] vr, ref int ldvr, ref int ilo, ref int ihi, double[] scale, ref double abnrm, double[] rconde, double[] rcondv, [In,Out] complex[] work, ref int lwork, double[] rwork, ref int info);
412
413        [DllImport("mkl_custom32", EntryPoint = "DSYEVR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
414        private static extern void mkl_dsyevr (ref char jobz, ref char range, ref char uplo, ref int n,          double  [] A, ref int lda, ref double vl, ref double vu, ref int il, ref int iu, ref double abstol, ref int m, double[] w,          double  [] z, ref int ldz, int[] isuppz, double[] work, ref int lwork, int[] iwork, ref int liwork, ref int info);
415        //[DllImport("mkl_custom32", EntryPoint = "DSYEVR",CallingConvention =CallingConvention.Cdecl)]
416        //private static extern void mkl_dsyevr (ref char jobz, ref char range, ref char uplo, ref int n,          double  [] A, ref int lda, ref double vl, ref double vu, ref int il, ref int iu, ref double abstol, ref int m, double[] w,          double  [] z, ref int ldz, int[] isuppz, double[] work, ref int lwork, int[] iwork, ref int liwork, ref int info);
417        [DllImport("mkl_custom32", EntryPoint = "SSYEVR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
418        private static extern void mkl_ssyevr (ref char jobz, ref char range, ref char uplo, ref int n,          float   [] A, ref int lda, ref float  vl, ref float  vu, ref int il, ref int iu, ref float  abstol, ref int m, float [] w,          float   [] z, ref int ldz, int[] isuppz, float [] work, ref int lwork, int[] iwork, ref int liwork, ref int info);
419        [DllImport("mkl_custom32", EntryPoint = "CHEEVR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
420        private static extern void mkl_cheevr (ref char jobz, ref char range, ref char uplo, ref int n, [In,Out] fcomplex[] A, ref int lda, ref float  vl, ref float  vu, ref int il, ref int iu, ref float  abstol, ref int m, float [] w, [In,Out] fcomplex[] z, ref int ldz, int[] isuppz, [In,Out] fcomplex[] work, ref int lwork, float[] rwork, ref int lrwork, int[] iwork, ref int liwork, ref int info);
421        [DllImport("mkl_custom32", EntryPoint = "ZHEEVR",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
422        private static extern void mkl_zheevr (ref char jobz, ref char range, ref char uplo, ref int n, [In,Out] complex [] A, ref int lda, ref double vl, ref double vu, ref int il, ref int iu, ref double abstol, ref int m, double[] w, [In,Out] complex [] z, ref int ldz, int[] isuppz, [In,Out] complex[] work, ref int lwork, double[] rwork, ref int lrwork, int[] iwork, ref int liwork, ref int info);
423
424        [DllImport("mkl_custom32", EntryPoint = "DSYGV",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
425        private static extern void mkl_dsygv (ref int itype, ref char jobz, ref char uplo, ref int n, double  [] A, ref int lda, double  [] B, ref int ldb, double [] w, double [] work, ref int lwork, ref int info);
426        [DllImport("mkl_custom32", EntryPoint = "SSYGV",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
427        private static extern void mkl_ssygv (ref int itype, ref char jobz, ref char uplo, ref int n, float   [] A, ref int lda, float   [] B, ref int ldb, float [] w,  float  [] work, ref int lwork, ref int info);
428        [DllImport("mkl_custom32", EntryPoint = "CHEGV",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
429        private static extern void mkl_chegv (ref int itype, ref char jobz, ref char uplo, ref int n, [In,Out] fcomplex[] A, ref int lda, [In,Out] fcomplex [] B, ref int ldb, float  [] w, [In,Out] fcomplex[] work , ref int lwork, float[] rwork, ref int info);
430        [DllImport("mkl_custom32", EntryPoint = "ZHEGV",CallingConvention =CallingConvention.Cdecl),SuppressUnmanagedCodeSecurity]
431        private static extern void mkl_zhegv (ref int itype, ref char jobz, ref char uplo, ref int n, [In,Out] complex [] A, ref int lda, [In,Out] complex  [] B, ref int ldb, double [] w, [In,Out]  complex[] work , ref int lwork, double[] rwork, ref int info);
432        #endregion
433#endif
434        #endregion DLL INCLUDES
435
436        public ILLapackMKL10_0() {
437            Init();
438        }
439
440        public static void Init() {
441            try {
442                // unless the user explicitely configured the number of threads, let omp configure it!
443                if (Settings.MaxNumberThreadsConfigured) {
444                    SetDomainNumThreads(Settings.MaxNumberThreads);
445                }
446            } catch (System.IO.FileNotFoundException) { }
447        }
448
449        #region ILLAPACK INTERFACE
450
451        private int ILAENV (int ispec, string name, string opts, int n1, int n2, int n3, int n4) {
452            return mkl_ilaenv(ref ispec, ref name, ref opts, ref n1, ref n2, ref n3, ref n4);
453        }
454        private static void SetNumThreads(int numThreads) {
455            mkl_set_num_threads(numThreads);
456            //omp_set_num_threads(numThreads);
457        }
458        private static void SetDomainNumThreads(int numThreads) {
459            int mklblas = MKLValues.MKL_BLAS;
460            mkl_domain_set_num_threads(ref numThreads,ref mklblas);
461            //omp_set_num_threads(numThreads);
462        }
463        private static void SetDynamicThreads(bool dynamic) {
464            int val = dynamic ? 1 : 0;
465            mkl_set_dynamic(ref val);
466        }
467        public static int GetMaxThreads() {
468            int dummy = MKLValues.MKL_BLAS;
469            int ret = mkl_domain_get_max_threads(ref dummy);
470            return ret;
471        }
472
473        /// <summary>
474        /// Implement wrapper for ATLAS GeneralMatrixMultiply
475        /// </summary>
476        /// <param name="TransA">Transposition state for matrix A: one of the constants in enum CBlas_Transpose</param>
477        /// <param name="TransB">Transposition state for matrix B: one of the constants in enum CBlas_Transpose</param>
478        /// <param name="M">Number of rows in A</param>
479        /// <param name="N">Number of columns in B</param>
480        /// <param name="K">Number of columns in A and number of rows in B</param>
481        /// <param name="alpha">multiplicationi factor for A</param>
482        /// <param name="A">pointer to double array A</param>
483        /// <param name="lda">distance between first elements of each column for column based orientation or
484        /// distance between first elements of each row for row based orientation for matrix B</param>
485        /// <param name="B">pointer to double array B</param>
486        /// <param name="ldb">distance between first elements of each column for column based orientation or
487        /// distance between first elements of each row for row based orientation for matrix A</param>
488        /// <param name="beta">multiplication faktor for matrix B</param>
489        /// <param name="C">pointer to predefined double array C of neccessary length</param>
490        /// <param name="ldc">distance between first elements of each column for column based orientation or
491        /// distance between first elements of each row for row based orientation for matrix C</param>
492        /// <remarks>All parameters except C are readonly. Only elements of matrix C will be altered. C must be a predefined
493        /// continous double array of size MxN</remarks>
494        public void dgemm(char TransA, char TransB, int M, int N, int K, double alpha, IntPtr A, int lda, IntPtr B, int ldb, double beta, double[] C, int ldc) {
495            mkl_dgemm(ref TransA, ref TransB, ref M, ref  N, ref  K, ref  alpha, A, ref lda, B, ref ldb, ref  beta, C, ref  ldc);
496        }
497        /// <summary>
498        /// Implement wrapper for ATLAS GeneralMatrixMultiply
499        /// </summary>
500        /// <param name="TransA">Transposition state for matrix A: one of the constants in enum CBlas_Transpose</param>
501        /// <param name="TransB">Transposition state for matrix B: one of the constants in enum CBlas_Transpose</param>
502        /// <param name="M">Number of rows in A</param>
503        /// <param name="N">Number of columns in B</param>
504        /// <param name="K">Number of columns in A and number of rows in B</param>
505        /// <param name="alpha">multiplicationi factor for A</param>
506        /// <param name="A">pointer to double array A</param>
507        /// <param name="lda">distance between first elements of each column for column based orientation or
508        /// distance between first elements of each row for row based orientation for matrix B</param>
509        /// <param name="B">pointer to double array B</param>
510        /// <param name="ldb">distance between first elements of each column for column based orientation or
511        /// distance between first elements of each row for row based orientation for matrix A</param>
512        /// <param name="beta">multiplication faktor for matrix B</param>
513        /// <param name="C">pointer to predefined double array C of neccessary length</param>
514        /// <param name="ldc">distance between first elements of each column for column based orientation or
515        /// distance between first elements of each row for row based orientation for matrix C</param>
516        /// <remarks>All parameters except C are readonly. Only elements of matrix C will be altered. C must be a predefined
517        /// continous double array of size MxN</remarks>
518        public void sgemm(char TransA, char TransB, int M, int N, int K, float alpha, IntPtr A, int lda, IntPtr B, int ldb, float beta, float[] C, int ldc) {
519            mkl_sgemm(ref TransA, ref TransB, ref M, ref  N, ref  K, ref  alpha, A, ref lda, B, ref ldb, ref  beta, C, ref  ldc);
520        }
521        /// <summary>
522        /// Implement wrapper for ATLAS GeneralMatrixMultiply
523        /// </summary>
524        /// <param name="TransA">Transposition state for matrix A: one of the constants in enum CBlas_Transpose</param>
525        /// <param name="TransB">Transposition state for matrix B: one of the constants in enum CBlas_Transpose</param>
526        /// <param name="M">Number of rows in A</param>
527        /// <param name="N">Number of columns in B</param>
528        /// <param name="K">Number of columns in A and number of rows in B</param>
529        /// <param name="alpha">multiplicationi factor for A</param>
530        /// <param name="A">pointer to double array A</param>
531        /// <param name="lda">distance between first elements of each column for column based orientation or
532        /// distance between first elements of each row for row based orientation for matrix B</param>
533        /// <param name="B">pointer to double array B</param>
534        /// <param name="ldb">distance between first elements of each column for column based orientation or
535        /// distance between first elements of each row for row based orientation for matrix A</param>
536        /// <param name="beta">multiplication faktor for matrix B</param>
537        /// <param name="C">pointer to predefined double array C of neccessary length</param>
538        /// <param name="ldc">distance between first elements of each column for column based orientation or
539        /// distance between first elements of each row for row based orientation for matrix C</param>
540        /// <remarks>All parameters except C are readonly. Only elements of matrix C will be altered. C must be a predefined
541        /// continous double array of size MxN</remarks>
542        public void cgemm(char TransA, char TransB, int M, int N, int K, fcomplex alpha, IntPtr A, int lda, IntPtr B, int ldb, fcomplex beta, fcomplex[] C, int ldc) {
543            mkl_cgemm(ref TransA, ref TransB, ref M, ref  N, ref  K, ref  alpha, A, ref lda, B, ref ldb, ref  beta, C, ref  ldc);
544        }
545        /// <summary>
546        /// Implement wrapper for ATLAS GeneralMatrixMultiply
547        /// </summary>
548        /// <param name="TransA">Transposition state for matrix A: one of the constants in enum CBlas_Transpose</param>
549        /// <param name="TransB">Transposition state for matrix B: one of the constants in enum CBlas_Transpose</param>
550        /// <param name="M">Number of rows in A</param>
551        /// <param name="N">Number of columns in B</param>
552        /// <param name="K">Number of columns in A and number of rows in B</param>
553        /// <param name="alpha">multiplicationi factor for A</param>
554        /// <param name="A">pointer to double array A</param>
555        /// <param name="lda">distance between first elements of each column for column based orientation or
556        /// distance between first elements of each row for row based orientation for matrix B</param>
557        /// <param name="B">pointer to double array B</param>
558        /// <param name="ldb">distance between first elements of each column for column based orientation or
559        /// distance between first elements of each row for row based orientation for matrix A</param>
560        /// <param name="beta">multiplication faktor for matrix B</param>
561        /// <param name="C">pointer to predefined double array C of neccessary length</param>
562        /// <param name="ldc">distance between first elements of each column for column based orientation or
563        /// distance between first elements of each row for row based orientation for matrix C</param>
564        /// <remarks>All parameters except C are readonly. Only elements of matrix C will be altered. C must be a predefined
565        /// continous double array of size MxN</remarks>
566        public void zgemm(char TransA, char TransB, int M, int N, int K, complex alpha, IntPtr A, int lda, IntPtr B, int ldb, complex beta, complex[] C, int ldc) {
567            mkl_zgemm(ref TransA, ref TransB, ref M, ref  N, ref  K, ref  alpha, A, ref lda, B, ref ldb, ref  beta, C, ref  ldc);
568        }
569
570
571       
572        public void  dgesdd (char jobz, int m, int n,  double [] a, int lda,  double [] s,  double [] u, int ldu,  double [] vt, int ldvt, ref int info) {
573            try {
574                 double [] work = new  double [1] { ( double )0.0 };
575                int lwork = -1;
576                int[] iwork = new int[((m < n) ? m : n) * 8];
577                 mkl_dgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
578                if (work[0] != 0) {
579                    work = new  double [(int)work[0]];
580                    lwork = work.Length;
581                     mkl_dgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
582                }
583            } catch (Exception e) {
584                if (e is OutOfMemoryException) {
585                     dgesvd (jobz, m, n, a, lda, s, u, ldu, vt, ldvt, ref info);
586                }
587                throw new ILException("Unable to do " +  "dgesdd"  + ".", e);
588            }
589        }
590
591#region HYCALPER AUTO GENERATED CODE
592
593       
594        public void  sgesdd (char jobz, int m, int n,  float [] a, int lda,  float [] s,  float [] u, int ldu,  float [] vt, int ldvt, ref int info) {
595            try {
596                float [] work = new  float [1] { ( float )0.0 };
597                int lwork = -1;
598                int[] iwork = new int[((m < n) ? m : n) * 8];
599                mkl_sgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
600                if (work[0] != 0) {
601                    work = new  float [(int)work[0]];
602                    lwork = work.Length;
603                    mkl_sgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
604                }
605            } catch (Exception e) {
606                if (e is OutOfMemoryException) {
607                    sgesvd (jobz, m, n, a, lda, s, u, ldu, vt, ldvt, ref info);
608                }
609                throw new ILException("Unable to do " +  "sgesdd"  + ".", e);
610            }
611        }
612
613#endregion HYCALPER AUTO GENERATED CODE
614
615
616
617        public void  zgesdd (char jobz, int m, int n,  complex [] a, int lda,  double [] s,  complex [] u, int ldu, complex [] vt, int ldvt, ref int info)
618        {
619            try {
620                 complex [] work = new  complex [1] { (  complex )0.0 };
621                 double [] rwork;
622                int minMN = (m < n) ? m : n;
623                if (jobz == 'N') {
624                    rwork = new  double [minMN * 7]; 
625                } else {
626                    rwork = new  double [5 * minMN * minMN + 5 * minMN]; 
627                }
628                int lwork = -1;
629                int[] iwork = new int[minMN * 8];
630                 mkl_zgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, rwork, iwork, ref info);
631                if (work[0] != 0) {
632                    work = new  complex [(int)work[0].real];
633                    lwork = work.Length;
634                     mkl_zgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork,rwork, iwork, ref info);
635                }
636            } catch (Exception e) {
637                if (e is OutOfMemoryException) {
638                     zgesvd (jobz, m, n, a, lda, s, u, ldu, vt, ldvt, ref info);
639                }
640                throw new ILException("Unable to do " +  "zgesdd"  + ".", e);
641            }
642        }
643
644#region HYCALPER AUTO GENERATED CODE
645
646
647        public void  cgesdd (char jobz, int m, int n,  fcomplex [] a, int lda,  float [] s,  fcomplex [] u, int ldu, fcomplex [] vt, int ldvt, ref int info)
648        {
649            try {
650                fcomplex [] work = new  fcomplex [1] { (  fcomplex )0.0 };
651                float [] rwork;
652                int minMN = (m < n) ? m : n;
653                if (jobz == 'N') {
654                    rwork = new  float [minMN * 7]; 
655                } else {
656                    rwork = new  float [5 * minMN * minMN + 5 * minMN]; 
657                }
658                int lwork = -1;
659                int[] iwork = new int[minMN * 8];
660                mkl_cgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, rwork, iwork, ref info);
661                if (work[0] != 0) {
662                    work = new  fcomplex [(int)work[0].real];
663                    lwork = work.Length;
664                    mkl_cgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork,rwork, iwork, ref info);
665                }
666            } catch (Exception e) {
667                if (e is OutOfMemoryException) {
668                    cgesvd (jobz, m, n, a, lda, s, u, ldu, vt, ldvt, ref info);
669                }
670                throw new ILException("Unable to do " +  "zgesdd"  + ".", e);
671            }
672        }
673
674#endregion HYCALPER AUTO GENERATED CODE
675
676
677       
678
679        /// <summary>
680        /// singular value decomposition
681        /// </summary>
682        /// <param name="jobz"></param>
683        /// <param name="m"></param>
684        /// <param name="n"></param>
685        /// <param name="a"></param>
686        /// <param name="lda"></param>
687        /// <param name="s"></param>
688        /// <param name="u"></param>
689        /// <param name="ldu"></param>
690        /// <param name="vt"></param>
691        /// <param name="ldvt"></param>
692        /// <param name="info"></param>
693        public void  dgesvd (char jobz, int m, int n,  double [] a, int lda,
694                            double [] s,  double [] u, int ldu,  double [] vt, int ldvt, ref int info) {
695            if (jobz != 'A' && jobz != 'S' && jobz != 'N')
696                throw new ILArgumentException("Argument jobz must be one of 'A','S' or 'N'");
697            try {
698                 double [] work = new  double [1] { ( double )0.0 };
699                int lwork = -1;
700                int[] iwork = new int[((m < n) ? m : n) * 8];
701                 mkl_dgesvd (ref jobz, ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
702                if (work[0] != 0) {
703                    work = new  double [(int)work[0]];
704                    lwork = work.Length;
705                     mkl_dgesvd (ref jobz, ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
706                }
707            } catch (Exception e) {
708                if (e is OutOfMemoryException) {
709                    throw new ILMemoryException("Not enough memory for given arguments.");
710                }
711                throw new ILException("Unable to do gesvd.", e);
712            }
713        }
714
715#region HYCALPER AUTO GENERATED CODE
716
717       
718
719        /// <summary>
720        /// singular value decomposition
721        /// </summary>
722        /// <param name="jobz"></param>
723        /// <param name="m"></param>
724        /// <param name="n"></param>
725        /// <param name="a"></param>
726        /// <param name="lda"></param>
727        /// <param name="s"></param>
728        /// <param name="u"></param>
729        /// <param name="ldu"></param>
730        /// <param name="vt"></param>
731        /// <param name="ldvt"></param>
732        /// <param name="info"></param>
733        public void  sgesvd (char jobz, int m, int n,  float [] a, int lda,
734                           float [] s,  float [] u, int ldu,  float [] vt, int ldvt, ref int info) {
735            if (jobz != 'A' && jobz != 'S' && jobz != 'N')
736                throw new ILArgumentException("Argument jobz must be one of 'A','S' or 'N'");
737            try {
738                float [] work = new  float [1] { ( float )0.0 };
739                int lwork = -1;
740                int[] iwork = new int[((m < n) ? m : n) * 8];
741                mkl_sgesvd (ref jobz, ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
742                if (work[0] != 0) {
743                    work = new  float [(int)work[0]];
744                    lwork = work.Length;
745                    mkl_sgesvd (ref jobz, ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
746                }
747            } catch (Exception e) {
748                if (e is OutOfMemoryException) {
749                    throw new ILMemoryException("Not enough memory for given arguments.");
750                }
751                throw new ILException("Unable to do gesvd.", e);
752            }
753        }
754       
755
756        /// <summary>
757        /// singular value decomposition
758        /// </summary>
759        /// <param name="jobz"></param>
760        /// <param name="m"></param>
761        /// <param name="n"></param>
762        /// <param name="a"></param>
763        /// <param name="lda"></param>
764        /// <param name="s"></param>
765        /// <param name="u"></param>
766        /// <param name="ldu"></param>
767        /// <param name="vt"></param>
768        /// <param name="ldvt"></param>
769        /// <param name="info"></param>
770        public void  zgesvd (char jobz, int m, int n,  complex [] a, int lda,
771                           double [] s,  complex [] u, int ldu,  complex [] vt, int ldvt, ref int info) {
772            if (jobz != 'A' && jobz != 'S' && jobz != 'N')
773                throw new ILArgumentException("Argument jobz must be one of 'A','S' or 'N'");
774            try {
775                complex [] work = new  complex [1] { ( complex )0.0 };
776                int lwork = -1;
777                int[] iwork = new int[((m < n) ? m : n) * 8];
778                mkl_zgesvd (ref jobz, ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
779                if (work[0] != 0) {
780                    work = new  complex [(int)work[0]];
781                    lwork = work.Length;
782                    mkl_zgesvd (ref jobz, ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
783                }
784            } catch (Exception e) {
785                if (e is OutOfMemoryException) {
786                    throw new ILMemoryException("Not enough memory for given arguments.");
787                }
788                throw new ILException("Unable to do gesvd.", e);
789            }
790        }
791       
792
793        /// <summary>
794        /// singular value decomposition
795        /// </summary>
796        /// <param name="jobz"></param>
797        /// <param name="m"></param>
798        /// <param name="n"></param>
799        /// <param name="a"></param>
800        /// <param name="lda"></param>
801        /// <param name="s"></param>
802        /// <param name="u"></param>
803        /// <param name="ldu"></param>
804        /// <param name="vt"></param>
805        /// <param name="ldvt"></param>
806        /// <param name="info"></param>
807        public void  cgesvd (char jobz, int m, int n,  fcomplex [] a, int lda,
808                           float [] s,  fcomplex [] u, int ldu,  fcomplex [] vt, int ldvt, ref int info) {
809            if (jobz != 'A' && jobz != 'S' && jobz != 'N')
810                throw new ILArgumentException("Argument jobz must be one of 'A','S' or 'N'");
811            try {
812                fcomplex [] work = new  fcomplex [1] { ( fcomplex )0.0 };
813                int lwork = -1;
814                int[] iwork = new int[((m < n) ? m : n) * 8];
815                mkl_cgesvd (ref jobz, ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
816                if (work[0] != 0) {
817                    work = new  fcomplex [(int)work[0]];
818                    lwork = work.Length;
819                    mkl_cgesvd (ref jobz, ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
820                }
821            } catch (Exception e) {
822                if (e is OutOfMemoryException) {
823                    throw new ILMemoryException("Not enough memory for given arguments.");
824                }
825                throw new ILException("Unable to do gesvd.", e);
826            }
827        }
828
829#endregion HYCALPER AUTO GENERATED CODE
830
831        public void dpotrf(char uplo, int n, double[] A, int lda, ref int info) {
832            mkl_dpotrf(ref uplo, ref n, A, ref lda, ref info);
833        }
834        public void spotrf(char uplo, int n, float[] A, int lda, ref int info) {
835            mkl_spotrf(ref uplo, ref n, A, ref lda, ref info);
836        }
837        public void cpotrf(char uplo, int n, fcomplex[] A, int lda, ref int info) {
838            mkl_cpotrf(ref uplo, ref n, A, ref lda, ref info);
839        }
840        public void zpotrf(char uplo, int n, complex[] A, int lda, ref int info) {
841            mkl_zpotrf(ref uplo, ref n, A, ref lda, ref info);
842        }
843
844
845        public void dpotri(char uplo, int n, double[] A, int lda, ref int info) {
846            mkl_dpotri(ref uplo, ref n, A, ref lda, ref info);
847        }
848        public void spotri(char uplo, int n, float[] A, int lda, ref int info) {
849            mkl_spotri(ref uplo, ref n, A, ref lda, ref info);
850        }
851        public void cpotri(char uplo, int n, fcomplex[] A, int lda, ref int info) {
852            mkl_cpotri(ref uplo, ref n, A, ref lda, ref info);
853        }
854        public void zpotri(char uplo, int n, complex[] A, int lda, ref int info) {
855            mkl_zpotri(ref uplo, ref n, A, ref lda, ref info);
856        }
857
858
859        public void dgetrf(int M, int N, double[] A, int LDA, int[] IPIV, ref int info) {
860            mkl_dgetrf(ref M, ref N, A, ref LDA, IPIV, ref info);
861        }
862        public void sgetrf(int M, int N, float[] A, int LDA, int[] IPIV, ref int info) {
863            mkl_sgetrf(ref M, ref N, A, ref LDA, IPIV, ref info);
864        }
865        public void cgetrf(int M, int N, fcomplex[] A, int LDA, int[] IPIV, ref int info) {
866            mkl_cgetrf(ref M, ref N, A, ref LDA, IPIV, ref info);
867        }
868        public void zgetrf(int M, int N, complex[] A, int LDA, int[] IPIV, ref int info) {
869            mkl_zgetrf(ref M, ref N, A, ref LDA, IPIV, ref info);
870        }
871
872
873       
874        public void  dgetri (int N,  double [] A, int LDA, int[] IPIV, ref int info) {
875             double [] work = new  double [1]; 
876            int lwork = -1;
877            try {
878                 mkl_dgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
879                lwork = (int)work[0];
880                if (lwork > 0 && info == 0) {
881                    work = new  double [lwork];
882                     mkl_dgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
883                } else {
884                    throw new ILException("error in mkl_dgetri");
885                }
886            } catch (OutOfMemoryException e) {
887                throw new ILException("error on dgetri. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
888            }
889        }
890
891#region HYCALPER AUTO GENERATED CODE
892
893       
894        public void  sgetri (int N,  float [] A, int LDA, int[] IPIV, ref int info) {
895            float [] work = new  float [1]; 
896            int lwork = -1;
897            try {
898                mkl_sgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
899                lwork = (int)work[0];
900                if (lwork > 0 && info == 0) {
901                    work = new  float [lwork];
902                    mkl_sgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
903                } else {
904                    throw new ILException("error in mkl_dgetri");
905                }
906            } catch (OutOfMemoryException e) {
907                throw new ILException("error on dgetri. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
908            }
909        }
910       
911        public void  zgetri (int N,  complex [] A, int LDA, int[] IPIV, ref int info) {
912            complex [] work = new  complex [1]; 
913            int lwork = -1;
914            try {
915                mkl_zgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
916                lwork = (int)work[0];
917                if (lwork > 0 && info == 0) {
918                    work = new  complex [lwork];
919                    mkl_zgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
920                } else {
921                    throw new ILException("error in mkl_dgetri");
922                }
923            } catch (OutOfMemoryException e) {
924                throw new ILException("error on dgetri. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
925            }
926        }
927       
928        public void  cgetri (int N,  fcomplex [] A, int LDA, int[] IPIV, ref int info) {
929            fcomplex [] work = new  fcomplex [1]; 
930            int lwork = -1;
931            try {
932                mkl_cgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
933                lwork = (int)work[0];
934                if (lwork > 0 && info == 0) {
935                    work = new  fcomplex [lwork];
936                    mkl_cgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
937                } else {
938                    throw new ILException("error in mkl_dgetri");
939                }
940            } catch (OutOfMemoryException e) {
941                throw new ILException("error on dgetri. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
942            }
943        }
944
945#endregion HYCALPER AUTO GENERATED CODE
946
947
948       
949        public void  dgeqrf (int M, int N,  double [] A, int lda,  double [] tau, ref int info) {
950             double [] work = new  double [1]; 
951            int lwork = -1;
952            try {
953                 mkl_dgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
954                lwork = (int)work[0];
955                if (lwork > 0 && info == 0) {
956                    work = new  double [lwork];
957                     mkl_dgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
958                } else {
959                    throw new ILException("error in mkl_?geqrf");
960                }
961            } catch (OutOfMemoryException e) {
962                throw new ILException("error on ?geqrf. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
963            }
964        }
965
966#region HYCALPER AUTO GENERATED CODE
967
968       
969        public void  sgeqrf (int M, int N,  float [] A, int lda,  float [] tau, ref int info) {
970            float [] work = new  float [1]; 
971            int lwork = -1;
972            try {
973                mkl_sgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
974                lwork = (int)work[0];
975                if (lwork > 0 && info == 0) {
976                    work = new  float [lwork];
977                    mkl_sgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
978                } else {
979                    throw new ILException("error in mkl_?geqrf");
980                }
981            } catch (OutOfMemoryException e) {
982                throw new ILException("error on ?geqrf. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
983            }
984        }
985       
986        public void  zgeqrf (int M, int N,  complex [] A, int lda,  complex [] tau, ref int info) {
987            complex [] work = new  complex [1]; 
988            int lwork = -1;
989            try {
990                mkl_zgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
991                lwork = (int)work[0];
992                if (lwork > 0 && info == 0) {
993                    work = new  complex [lwork];
994                    mkl_zgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
995                } else {
996                    throw new ILException("error in mkl_?geqrf");
997                }
998            } catch (OutOfMemoryException e) {
999                throw new ILException("error on ?geqrf. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
1000            }
1001        }
1002       
1003        public void  cgeqrf (int M, int N,  fcomplex [] A, int lda,  fcomplex [] tau, ref int info) {
1004            fcomplex [] work = new  fcomplex [1]; 
1005            int lwork = -1;
1006            try {
1007                mkl_cgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
1008                lwork = (int)work[0];
1009                if (lwork > 0 && info == 0) {
1010                    work = new  fcomplex [lwork];
1011                    mkl_cgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
1012                } else {
1013                    throw new ILException("error in mkl_?geqrf");
1014                }
1015            } catch (OutOfMemoryException e) {
1016                throw new ILException("error on ?geqrf. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
1017            }
1018        }
1019
1020#endregion HYCALPER AUTO GENERATED CODE
1021
1022        public void dormqr(char side, char trans, int m, int n, int k, double[] A, int lda, double[] tau, double[] C, int LDC, ref int info) {
1023            throw new Exception("The method or operation is not implemented.");
1024        }
1025        public void sormqr(char side, char trans, int m, int n, int k, float[] A, int lda, float[] tau, float[] C, int LDC, ref int info) {
1026            throw new Exception("The method or operation is not implemented.");
1027        }
1028
1029
1030       
1031        public void  dorgqr (int M, int N, int K,  double [] A, int lda,  double [] tau, ref int info) {
1032             double [] work = new  double [1]; 
1033            int lwork = -1;
1034            try {
1035                /*!HC:mkl_***gqr*/ mkl_dorgqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
1036                lwork = (int)work[0];
1037                if (lwork > 0 && info == 0) {
1038                    work = new  double [lwork];
1039                    /*!HC:mkl_***gqr*/ mkl_dorgqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
1040                } else {
1041                    throw new ILException("error in mkl_?[un/or]gqr");
1042                }
1043            } catch (OutOfMemoryException e) {
1044                throw new ILException("error on ?[un/or]gqr. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
1045            }
1046        }
1047
1048#region HYCALPER AUTO GENERATED CODE
1049
1050       
1051        public void  sorgqr (int M, int N, int K,  float [] A, int lda,  float [] tau, ref int info) {
1052            float [] work = new  float [1]; 
1053            int lwork = -1;
1054            try {
1055                mkl_sorgqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
1056                lwork = (int)work[0];
1057                if (lwork > 0 && info == 0) {
1058                    work = new  float [lwork];
1059                    mkl_sorgqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
1060                } else {
1061                    throw new ILException("error in mkl_?[un/or]gqr");
1062                }
1063            } catch (OutOfMemoryException e) {
1064                throw new ILException("error on ?[un/or]gqr. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
1065            }
1066        }
1067       
1068        public void  zungqr (int M, int N, int K,  complex [] A, int lda,  complex [] tau, ref int info) {
1069            complex [] work = new  complex [1]; 
1070            int lwork = -1;
1071            try {
1072                mkl_zungqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
1073                lwork = (int)work[0];
1074                if (lwork > 0 && info == 0) {
1075                    work = new  complex [lwork];
1076                    mkl_zungqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
1077                } else {
1078                    throw new ILException("error in mkl_?[un/or]gqr");
1079                }
1080            } catch (OutOfMemoryException e) {
1081                throw new ILException("error on ?[un/or]gqr. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
1082            }
1083        }
1084       
1085        public void  cungqr (int M, int N, int K,  fcomplex [] A, int lda,  fcomplex [] tau, ref int info) {
1086            fcomplex [] work = new  fcomplex [1]; 
1087            int lwork = -1;
1088            try {
1089                mkl_cungqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
1090                lwork = (int)work[0];
1091                if (lwork > 0 && info == 0) {
1092                    work = new  fcomplex [lwork];
1093                    mkl_cungqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
1094                } else {
1095                    throw new ILException("error in mkl_?[un/or]gqr");
1096                }
1097            } catch (OutOfMemoryException e) {
1098                throw new ILException("error on ?[un/or]gqr. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
1099            }
1100        }
1101
1102#endregion HYCALPER AUTO GENERATED CODE
1103
1104
1105       
1106        public void  dgeqp3 ( int M,int N, double [] A,int LDA,int [] JPVT, double [] tau, ref int info ) {
1107             double [] work = new  double [1];
1108            int lwork = -1;
1109            try {
1110                 
1111                /*dummy*/
1112                 
1113                mkl_dgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, ref info);
1114                lwork = (int)work[0];
1115                if (lwork > 0 && info == 0) {
1116                    work = ILMemoryPool.Pool.New<  double >(lwork);
1117                     
1118                    mkl_dgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, ref info);
1119                    ILMemoryPool.Pool.Free(work);
1120                } else {
1121                    throw new ILException("error in mkl_?geqp3");
1122                }
1123            } catch (OutOfMemoryException e) {
1124                throw new ILException("error on ?geqp3. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
1125            }
1126        }
1127
1128#region HYCALPER AUTO GENERATED CODE
1129
1130       
1131        public void  sgeqp3 ( int M,int N, float [] A,int LDA,int [] JPVT, float [] tau, ref int info ) {
1132            float [] work = new  float [1];
1133            int lwork = -1;
1134            try {
1135               
1136                mkl_sgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, ref info);
1137                lwork = (int)work[0];
1138                if (lwork > 0 && info == 0) {
1139                    work = ILMemoryPool.Pool.New<  float >(lwork);
1140                    mkl_sgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, ref info);
1141                    ILMemoryPool.Pool.Free(work);
1142                } else {
1143                    throw new ILException("error in mkl_?geqp3");
1144                }
1145            } catch (OutOfMemoryException e) {
1146                throw new ILException("error on ?geqp3. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
1147            }
1148        }
1149       
1150        public void  zgeqp3 ( int M,int N, complex [] A,int LDA,int [] JPVT, complex [] tau, ref int info ) {
1151            complex [] work = new  complex [1];
1152            int lwork = -1;
1153            try {
1154                double[] rwork = new double[2 * N];
1155                mkl_zgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, rwork, ref info);
1156                lwork = (int)work[0];
1157                if (lwork > 0 && info == 0) {
1158                    work = ILMemoryPool.Pool.New<  complex >(lwork);
1159                    mkl_zgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, rwork, ref info);
1160                    ILMemoryPool.Pool.Free(work);
1161                } else {
1162                    throw new ILException("error in mkl_?geqp3");
1163                }
1164            } catch (OutOfMemoryException e) {
1165                throw new ILException("error on ?geqp3. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
1166            }
1167        }
1168       
1169        public void  cgeqp3 ( int M,int N, fcomplex [] A,int LDA,int [] JPVT, fcomplex [] tau, ref int info ) {
1170            fcomplex [] work = new  fcomplex [1];
1171            int lwork = -1;
1172            try {
1173                float[] rwork = new float[2 * N];
1174                mkl_cgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, rwork, ref info);
1175                lwork = (int)work[0];
1176                if (lwork > 0 && info == 0) {
1177                    work = ILMemoryPool.Pool.New<  fcomplex >(lwork);
1178                    mkl_cgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, rwork, ref info);
1179                    ILMemoryPool.Pool.Free(work);
1180                } else {
1181                    throw new ILException("error in mkl_?geqp3");
1182                }
1183            } catch (OutOfMemoryException e) {
1184                throw new ILException("error on ?geqp3. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
1185            }
1186        }
1187
1188#endregion HYCALPER AUTO GENERATED CODE
1189
1190        public void dtrtrs(char uplo, char transA, char diag, int N, int nrhs, IntPtr A, int LDA, IntPtr B, int LDB, ref int info) {
1191            mkl_dtrtrs(ref uplo, ref transA, ref diag, ref N, ref nrhs, A, ref LDA, B, ref LDB, ref info);
1192        }
1193        public void strtrs(char uplo, char transA, char diag, int N, int nrhs, IntPtr A, int LDA, IntPtr B, int LDB, ref int info) {
1194            mkl_strtrs(ref uplo, ref transA, ref diag, ref N, ref nrhs, A, ref LDA, B, ref LDB, ref info);
1195        }
1196        public void ctrtrs(char uplo, char transA, char diag, int N, int nrhs, IntPtr A, int LDA, IntPtr B, int LDB, ref int info) {
1197            mkl_ctrtrs(ref uplo, ref transA, ref diag, ref N, ref nrhs, A, ref LDA, B, ref LDB, ref info);
1198        }
1199        public void ztrtrs(char uplo, char transA, char diag, int N, int nrhs, IntPtr A, int LDA, IntPtr B, int LDB, ref int info) {
1200            mkl_ztrtrs(ref uplo, ref transA, ref diag, ref N, ref nrhs, A, ref LDA, B, ref LDB, ref info);
1201        }
1202
1203        public void dgetrs(char trans, int N, int NRHS, double[] A, int LDA, int[] IPIV, double[] B, int LDB, ref int info) {
1204            mkl_dgetrs(ref trans,ref N,ref NRHS, A, ref LDA, IPIV, B, ref LDB, ref info);     
1205        }
1206
1207        public void sgetrs(char trans, int N, int NRHS, float[] A, int LDA, int[] IPIV, float[] B, int LDB, ref int info) {
1208            mkl_sgetrs(ref trans,ref N,ref NRHS, A, ref LDA, IPIV, B, ref LDB, ref info);     
1209        }
1210
1211        public void cgetrs(char trans, int N, int NRHS, fcomplex[] A, int LDA, int[] IPIV, fcomplex[] B, int LDB, ref int info) {
1212            mkl_cgetrs(ref trans,ref N,ref NRHS, A, ref LDA, IPIV, B, ref LDB, ref info);     
1213        }
1214
1215        public void zgetrs(char trans, int N, int NRHS, complex[] A, int LDA, int[] IPIV, complex[] B, int LDB, ref int info) {
1216            mkl_zgetrs(ref trans,ref N,ref NRHS, A, ref LDA, IPIV, B, ref LDB, ref info);
1217        }
1218       
1219        public void dpotrs(char uplo, int n, int nrhs, double[] A, int lda, double[] B, int ldb, ref int info) {
1220            mkl_dpotrs(ref uplo, ref n, ref nrhs, A, ref lda, B, ref ldb, ref info);
1221        }
1222
1223        public void spotrs(char uplo, int n, int nrhs, float[] A, int lda, float[] B, int ldb, ref int info) {
1224            mkl_spotrs(ref uplo, ref n, ref nrhs, A, ref lda, B, ref ldb, ref info);
1225        }
1226
1227        public void cpotrs(char uplo, int n, int nrhs, fcomplex[] A, int lda, fcomplex[] B, int ldb, ref int info) {
1228            mkl_cpotrs(ref uplo, ref n, ref nrhs, A, ref lda, B, ref ldb, ref info);
1229        }
1230
1231        public void zpotrs(char uplo, int n, int nrhs, complex[] A, int lda, complex[] B, int ldb, ref int info) {
1232            mkl_zpotrs(ref uplo, ref n, ref nrhs, A, ref lda, B, ref ldb, ref info);
1233        }
1234
1235
1236       
1237        public void  dgelsd (int m, int n, int nrhs,  double [] A, int lda,  double [] B, int ldb,  double [] S,  double RCond, ref int rank, ref int info) {
1238             double [] work = new  double [1];
1239            int [] iwork = new int[1];
1240            int lwork = -1;
1241            /*HC:HycalpTag1*/
1242            mkl_dgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, iwork, ref info);
1243            if (info != 0)
1244                throw new ILArgumentException("dgelsd: invalid parameter: #" + (-info).ToString());
1245            lwork = (int)work[0]; //ILAENV(9, "dgelsd", " ",0,0,0,0);
1246            if (lwork <= 0)
1247                throw new ILArgumentException("dgelsd: unknown error determining working size lwork");
1248            iwork = new int[lwork * 1000];
1249           
1250            work = ILMemoryPool.Pool.New<  double >(lwork);
1251            /*HC:HycalpTag2*/
1252            mkl_dgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, iwork, ref info);
1253            ILMemoryPool.Pool.Free(work);
1254        }
1255
1256#region HYCALPER AUTO GENERATED CODE
1257
1258       
1259        public void  sgelsd  (int m, int n, int nrhs,  float [] A, int lda,  float [] B, int ldb,  float [] S,  float RCond, ref int rank, ref int info) {
1260            float [] work = new  float [1];
1261            int [] iwork = new int[1];
1262            int lwork = -1;
1263            mkl_sgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, iwork, ref info);
1264            if (info != 0)
1265                throw new ILArgumentException("dgelsd: invalid parameter: #" + (-info).ToString());
1266            lwork = (int)work[0]; //ILAENV(9, "dgelsd", " ",0,0,0,0);
1267            if (lwork <= 0)
1268                throw new ILArgumentException("dgelsd: unknown error determining working size lwork");
1269            iwork = new int[lwork * 1000];
1270           
1271            work = ILMemoryPool.Pool.New<  float >(lwork);
1272            mkl_sgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, iwork, ref info);
1273            ILMemoryPool.Pool.Free(work);
1274        }
1275       
1276        public void  zgelsd  (int m, int n, int nrhs,  complex [] A, int lda,  complex [] B, int ldb,  double [] S,  double RCond, ref int rank, ref int info) {
1277            complex [] work = new  complex [1];
1278            int [] iwork = new int[1];
1279            int lwork = -1;
1280            double [] rwork = new double [1];  mkl_zgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, rwork, iwork, ref info);
1281            if (info != 0)
1282                throw new ILArgumentException("dgelsd: invalid parameter: #" + (-info).ToString());
1283            lwork = (int)work[0]; //ILAENV(9, "dgelsd", " ",0,0,0,0);
1284            if (lwork <= 0)
1285                throw new ILArgumentException("dgelsd: unknown error determining working size lwork");
1286            iwork = new int[lwork * 1000];
1287           
1288            work = ILMemoryPool.Pool.New<  complex >(lwork);
1289            rwork = new double [(int)rwork[0]];  mkl_zgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, rwork, iwork, ref info);
1290            ILMemoryPool.Pool.Free(work);
1291        }
1292       
1293        public void  cgelsd  (int m, int n, int nrhs,  fcomplex [] A, int lda,  fcomplex [] B, int ldb,  float [] S,  float RCond, ref int rank, ref int info) {
1294            fcomplex [] work = new  fcomplex [1];
1295            int [] iwork = new int[1];
1296            int lwork = -1;
1297            float [] rwork = new float [1];  mkl_cgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, rwork, iwork, ref info);
1298            if (info != 0)
1299                throw new ILArgumentException("dgelsd: invalid parameter: #" + (-info).ToString());
1300            lwork = (int)work[0]; //ILAENV(9, "dgelsd", " ",0,0,0,0);
1301            if (lwork <= 0)
1302                throw new ILArgumentException("dgelsd: unknown error determining working size lwork");
1303            iwork = new int[lwork * 1000];
1304           
1305            work = ILMemoryPool.Pool.New<  fcomplex >(lwork);
1306            rwork = new float [(int)rwork[0]];  mkl_cgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, rwork, iwork, ref info);
1307            ILMemoryPool.Pool.Free(work);
1308        }
1309
1310#endregion HYCALPER AUTO GENERATED CODE
1311
1312        #region ?gelsy 
1313        public void dgelsy (int m, int n, int nrhs, double [] A, int lda, double [] B, int ldb, int[] JPVT0, double RCond, ref int rank, ref int info) {
1314            int lwork = -1;
1315            double [] work = new double [1];
1316            mkl_dgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork,ref info);
1317            if (info != 0)
1318                throw new ILArgumentException("?gelsy: unable to determine optimal block size. cancelling...");
1319            lwork = (int) work[0];
1320            work = ILMemoryPool.Pool.New<double>(lwork);
1321            mkl_dgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork,ref info);
1322            ILMemoryPool.Pool.Free(work);
1323        }
1324        public void  sgelsy  (int m, int n, int nrhs,  float [] A, int lda,  float [] B, int ldb, int[] JPVT0,  float RCond, ref int rank, ref int info) {
1325            int lwork = -1;
1326            float [] work = new  float [1];
1327            mkl_sgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork,ref info);
1328            if (info != 0)
1329                throw new ILArgumentException("?gelsy: unable to determine optimal block size. cancelling...");
1330            lwork = (int) work[0];
1331            work = ILMemoryPool.Pool.New<float>(lwork);
1332            mkl_sgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork,ref info);
1333            ILMemoryPool.Pool.Free(work);
1334        }
1335       
1336        public void  zgelsy  (int m, int n, int nrhs,  complex [] A, int lda,  complex [] B, int ldb, int[] JPVT0,  double RCond, ref int rank, ref int info) {
1337            int lwork = -1;
1338            complex [] work = new  complex [1];
1339            double[] rwork = new double[1];
1340            mkl_zgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork, rwork, ref info);
1341            if (info != 0)
1342                throw new ILArgumentException("?gelsy: unable to determine optimal block size. cancelling...");
1343            lwork = (int) work[0];
1344            work = ILMemoryPool.Pool.New<complex>(lwork);
1345            rwork = ILMemoryPool.Pool.New<double>(lwork);
1346            mkl_zgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork, rwork, ref info);
1347            ILMemoryPool.Pool.Free(work);
1348            ILMemoryPool.Pool.Free(rwork);
1349        }
1350       
1351        public void  cgelsy  (int m, int n, int nrhs,  fcomplex [] A, int lda,  fcomplex [] B, int ldb, int[] JPVT0,  float RCond, ref int rank, ref int info) {
1352            int lwork = -1;
1353            fcomplex [] work = new  fcomplex [1];
1354            float[] rwork = new float[1];
1355            mkl_cgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork, rwork, ref info);
1356            if (info != 0)
1357                throw new ILArgumentException("?gelsy: unable to determine optimal block size. cancelling...");
1358            lwork = (int) work[0];
1359            work = ILMemoryPool.Pool.New<fcomplex>(lwork);
1360            rwork = ILMemoryPool.Pool.New<float>(lwork);
1361            mkl_cgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork, rwork, ref info);
1362            ILMemoryPool.Pool.Free(work);
1363            ILMemoryPool.Pool.Free(rwork);
1364        }
1365#endregion
1366
1367        #region ?GEEVX
1368        public void dgeevx(char balance, char jobvl, char jobvr, char sense, int n, double[] A, int lda, double[] wr, double[] wi, double[] vl, int ldvl, double[] vr, int ldvr, ref int ilo, ref int ihi, double[] scale, ref double abnrm, double[] rconde, double[] rcondv, ref int info) {
1369            double [] work = new double[1];
1370            int lwork = -1;
1371            int [] iwork = ILMemoryPool.Pool.New<int>(2 * n - 2);
1372            mkl_dgeevx(ref balance, ref jobvl, ref jobvr, ref sense, ref n, A, ref lda, wr, wi, vl, ref ldvl, vr, ref ldvr, ref ilo, ref ihi, scale, ref abnrm, rconde, rcondv, work, ref lwork, iwork, ref info);
1373            if (info != 0)
1374                throw new ILArgumentException("error in lapack call: ?geevx. (" + info + ")");
1375            lwork = (int)work[0];
1376            work = ILMemoryPool.Pool.New<double>(lwork);
1377            mkl_dgeevx(ref balance, ref jobvl, ref jobvr, ref sense, ref n, A, ref lda, wr, wi, vl, ref ldvl, vr, ref ldvr, ref ilo, ref ihi, scale, ref abnrm, rconde, rcondv, work, ref lwork, iwork, ref info);
1378            ILMemoryPool.Pool.Free(work);
1379            ILMemoryPool.Pool.Free(iwork);
1380        }
1381        public void sgeevx(char balance, char jobvl, char jobvr, char sense, int n, float[] A, int lda, float[] wr, float[] wi, float[] vl, int ldvl, float[] vr, int ldvr, ref int ilo, ref int ihi, float[] scale, ref float abnrm, float[] rconde, float[] rcondv, ref int info) {
1382            float [] work = new float[1];
1383            int lwork = -1;
1384            int [] iwork = ILMemoryPool.Pool.New<int>(2 * n - 2);
1385            mkl_sgeevx(ref balance, ref jobvl, ref jobvr, ref sense, ref n, A, ref lda, wr, wi, vl, ref ldvl, vr, ref ldvr, ref ilo, ref ihi, scale, ref abnrm, rconde, rcondv, work, ref lwork, iwork, ref info);
1386            if (info != 0)
1387                throw new ILArgumentException("error in lapack call: ?geevx. (" + info + ")");
1388            lwork = (int)work[0];
1389            work = ILMemoryPool.Pool.New<float>(lwork);
1390            mkl_sgeevx(ref balance, ref jobvl, ref jobvr, ref sense, ref n, A, ref lda, wr, wi, vl, ref ldvl, vr, ref ldvr, ref ilo, ref ihi, scale, ref abnrm, rconde, rcondv, work, ref lwork, iwork, ref info);
1391            ILMemoryPool.Pool.Free(work);
1392            ILMemoryPool.Pool.Free(iwork);
1393        }
1394        public void cgeevx(char balance, char jobvl, char jobvr, char sense, int n, fcomplex[] A, int lda, fcomplex[] w, fcomplex[] vl, int ldvl, fcomplex[] vr, int ldvr, ref int ilo, ref int ihi, float[] scale, ref float abnrm, float[] rconde, float[] rcondv, ref int info) {
1395            fcomplex [] work = new fcomplex[1];
1396            int lwork = -1;
1397            float[] rwork = ILMemoryPool.Pool.New<float>(2 * n);
1398            mkl_cgeevx(ref balance, ref jobvl, ref jobvr, ref sense, ref n, A, ref lda, w, vl, ref ldvl, vr, ref ldvr, ref ilo, ref ihi, scale, ref abnrm, rconde, rcondv, work, ref lwork, rwork, ref info);
1399            if (info != 0)
1400                throw new ILArgumentException("error in lapack call: ?geevx. (" + info + ")");
1401            lwork = (int)work[0];
1402            work = ILMemoryPool.Pool.New<fcomplex>(lwork);
1403            mkl_cgeevx(ref balance, ref jobvl, ref jobvr, ref sense, ref n, A, ref lda, w, vl, ref ldvl, vr, ref ldvr, ref ilo, ref ihi, scale, ref abnrm, rconde, rcondv, work, ref lwork, rwork, ref info);
1404            ILMemoryPool.Pool.Free(work);
1405            ILMemoryPool.Pool.Free(rwork);
1406        }
1407        public void zgeevx(char balance, char jobvl, char jobvr, char sense, int n, complex[] A, int lda, complex[] w, complex[] vl, int ldvl, complex[] vr, int ldvr, ref int ilo, ref int ihi, double[] scale, ref double abnrm, double[] rconde, double[] rcondv, ref int info) {
1408            complex [] work = new complex[1];
1409            int lwork = -1;
1410            double[] rwork = ILMemoryPool.Pool.New<double>(2 * n);
1411            mkl_zgeevx(ref balance, ref jobvl, ref jobvr, ref sense, ref n, A, ref lda, w, vl, ref ldvl, vr, ref ldvr, ref ilo, ref ihi, scale, ref abnrm, rconde, rcondv, work, ref lwork, rwork, ref info);
1412            if (info != 0)
1413                throw new ILArgumentException("error in lapack call: ?geevx. (" + info + ")");
1414            lwork = (int)work[0];
1415            work = ILMemoryPool.Pool.New<complex>(lwork);
1416            mkl_zgeevx(ref balance, ref jobvl, ref jobvr, ref sense, ref n, A, ref lda, w, vl, ref ldvl, vr, ref ldvr, ref ilo, ref ihi, scale, ref abnrm, rconde, rcondv, work, ref lwork, rwork, ref info);
1417            ILMemoryPool.Pool.Free(work);
1418            ILMemoryPool.Pool.Free(rwork);
1419        }
1420        #endregion
1421
1422        #region ?syevr
1423        public void dsyevr(char jobz, char range, char uplo, int n, double[] A, int lda, double vl, double vu, int il, int iu, double abstol, ref int m, double[] w, double[] z, int ldz, int[] isuppz, ref int info) {
1424            double [] work = new double[1];
1425            int lwork = -1, liwork = -1;
1426            int [] iwork = new int[1];
1427            //byte jz = (byte)jobz,rn = (byte) range,ul = (byte)uplo;
1428            mkl_dsyevr(ref jobz,ref range,ref uplo,ref n, A,ref lda, ref vl, ref vu, ref il, ref iu, ref abstol,ref m, w,z,ref ldz,isuppz, work,ref lwork,iwork,ref liwork,ref info);
1429            if (info != 0) {
1430                throw new ILArgumentException("?syevr: error returned from lapack: " + info);
1431            }
1432            lwork = (int)work[0];
1433            bool dummy;
1434            work = ILMemoryPool.Pool.New<double>(lwork,true, out dummy);
1435            liwork = (int) iwork[0];
1436            iwork = ILMemoryPool.Pool.New<int>(liwork,true, out dummy);
1437            mkl_dsyevr(ref jobz,ref range,ref uplo,ref n, A,ref lda, ref vl, ref vu, ref il, ref iu, ref abstol,ref m, w,z,ref ldz,isuppz, work,ref lwork,iwork,ref liwork,ref info);
1438            ILMemoryPool.Pool.Free(iwork);
1439            ILMemoryPool.Pool.Free(work);
1440        }
1441        public void ssyevr(char jobz, char range, char uplo, int n, float[] A, int lda, float vl, float vu, int il, int iu, float abstol, ref int m, float[] w, float[] z, int ldz, int[] isuppz, ref int info) {
1442            float [] work = new float[1];
1443            int lwork = -1, liwork = -1;
1444            int [] iwork = new int[1];
1445            mkl_ssyevr(ref jobz,ref range,ref uplo,ref n, A,ref lda, ref vl, ref vu, ref il, ref iu, ref abstol,ref m, w,z,ref ldz,isuppz, work,ref lwork,iwork,ref liwork,ref info);
1446            if (info != 0) {
1447                throw new ILArgumentException("?syevr: error returned from lapack: " + info);
1448            }
1449            lwork = (int)work[0];
1450            work = ILMemoryPool.Pool.New<float>(lwork);
1451            liwork = (int) iwork[0];
1452            iwork = ILMemoryPool.Pool.New<int>(liwork);
1453            mkl_ssyevr(ref jobz,ref range,ref uplo,ref n, A,ref lda, ref vl, ref vu, ref il, ref iu, ref abstol,ref m, w,z,ref ldz,isuppz, work,ref lwork,iwork,ref liwork,ref info);
1454            ILMemoryPool.Pool.Free(iwork);
1455            ILMemoryPool.Pool.Free(work);
1456        }
1457        public void cheevr(char jobz, char range, char uplo, int n, fcomplex[] A, int lda, float vl, float vu, int il, int iu, float abstol, ref int m, float[] w, fcomplex[] z, int ldz, int[] isuppz, ref int info) {
1458            fcomplex[] work = new fcomplex[1];
1459            float [] rwork = new float[1];
1460            int [] iwork = new int[1];
1461            int lrwork = -1, liwork = -1, lwork = -1;
1462            mkl_cheevr(ref jobz,ref range,ref uplo,ref n, A,ref lda, ref vl, ref vu, ref il, ref iu, ref abstol,ref m, w,z,ref ldz,isuppz, work,ref lwork,rwork,ref lrwork, iwork,ref liwork,ref info);
1463            if (info != 0) {
1464                throw new ILArgumentException("?syevr: error returned from lapack: " + info);
1465            }
1466            lrwork = (int)rwork[0];
1467            rwork = ILMemoryPool.Pool.New<float>(lrwork);
1468            lwork = (int) work[0];
1469            work = ILMemoryPool.Pool.New<fcomplex>(lwork);
1470            liwork = (int) iwork[0];
1471            iwork = ILMemoryPool.Pool.New<int>(liwork);
1472            mkl_cheevr(ref jobz,ref range,ref uplo,ref n, A,ref lda, ref vl, ref vu, ref il, ref iu, ref abstol,ref m, w,z,ref ldz,isuppz, work,ref lwork,rwork,ref lrwork,iwork,ref liwork,ref info);
1473            ILMemoryPool.Pool.Free(iwork);
1474            ILMemoryPool.Pool.Free(work);
1475            ILMemoryPool.Pool.Free(rwork);
1476        }
1477        public void zheevr(char jobz, char range, char uplo, int n, complex[] A, int lda, double vl, double vu, int il, int iu, double abstol, ref int m, double[] w, complex[] z, int ldz, int[] isuppz, ref int info) {
1478            complex[] work = new complex[1];
1479            double [] rwork = new double[1];
1480            int [] iwork = new int[1];
1481            int lrwork = -1, liwork = -1, lwork = -1;
1482            mkl_zheevr(ref jobz,ref range,ref uplo,ref n, A,ref lda, ref vl, ref vu, ref il, ref iu, ref abstol,ref m, w,z,ref ldz,isuppz, work,ref lwork,rwork,ref lrwork, iwork,ref liwork,ref info);
1483            if (info != 0) {
1484                throw new ILArgumentException("?syevr: error returned from lapack: " + info);
1485            }
1486            lrwork = (int)rwork[0];
1487            rwork = ILMemoryPool.Pool.New<double>(lrwork);
1488            lwork = (int) work[0];
1489            work = ILMemoryPool.Pool.New<complex>(lwork);
1490            liwork = (int) iwork[0];
1491            iwork = ILMemoryPool.Pool.New<int>(liwork);
1492            mkl_zheevr(ref jobz,ref range,ref uplo,ref n, A,ref lda, ref vl, ref vu, ref il, ref iu, ref abstol,ref m, w,z,ref ldz,isuppz, work,ref lwork,rwork,ref lrwork,iwork,ref liwork,ref info);
1493            ILMemoryPool.Pool.Free(iwork);
1494            ILMemoryPool.Pool.Free(work);
1495            ILMemoryPool.Pool.Free(rwork);
1496        }
1497        #endregion
1498
1499        #region ?[he/sy]gv - generalized eigenproblem
1500        public void dsygv (int itype, char jobz, char uplo, int n, double  [] A, int lda, double  [] B, int ldb, double [] w, ref int info) {
1501            // query workspace
1502            int lwork = -1;
1503            double [] work = new double[1] {0.0};
1504            mkl_dsygv (ref itype,ref jobz,ref uplo,ref n, A,ref lda, B,ref ldb, w, work, ref lwork, ref info);
1505            if (info != 0 || work[0] <= 0.0) return;
1506            // create temporary array(s)
1507            lwork = (int) work[0];
1508            work = ILMemoryPool.Pool.New<double>(lwork);
1509            mkl_dsygv (ref itype,ref jobz,ref uplo,ref n, A,ref lda, B,ref ldb, w, work, ref lwork, ref info);
1510            ILMemoryPool.Pool.Free(work);
1511        }       
1512        public void ssygv (int itype, char jobz, char uplo, int n, float   [] A, int lda, float   [] B, int ldb, float  [] w, ref int info) {
1513            // query workspace
1514            int lwork = -1;
1515            float [] work = new float[1] {0.0f};
1516            mkl_ssygv (ref itype,ref jobz,ref uplo,ref n, A,ref lda, B,ref ldb, w, work, ref lwork, ref info);
1517            if (info != 0 || work[0] <= 0.0) return;
1518            // create temporary array(s)
1519            lwork = (int) work[0];
1520            work = ILMemoryPool.Pool.New<float>(lwork);
1521            mkl_ssygv (ref itype,ref jobz,ref uplo,ref n, A,ref lda, B,ref ldb, w, work, ref lwork, ref info);
1522            ILMemoryPool.Pool.Free(work);
1523        }
1524        public void chegv (int itype, char jobz, char uplo, int n, fcomplex[] A, int lda, fcomplex[] B, int ldb, float  [] w, ref int info) {
1525            // query workspace
1526            int lwork = -1;
1527            fcomplex [] work = new fcomplex[1] {0.0f};
1528            float [] rwork = ILMemoryPool.Pool.New<float>(Math.Max(1,3*n-2));
1529            mkl_chegv(ref itype,ref  jobz,ref  uplo,ref  n, A,ref  lda, B,ref  ldb, w, work, ref lwork, rwork, ref info);
1530            if (info != 0 || work[0] <= 0.0) return;
1531            // create temporary array(s)
1532            lwork = (int) work[0];
1533            work = ILMemoryPool.Pool.New<fcomplex>(lwork);
1534            mkl_chegv (ref itype,ref  jobz,ref  uplo,ref  n, A,ref  lda, B,ref  ldb, w, work, ref lwork, rwork, ref info);
1535            ILMemoryPool.Pool.Free(rwork);
1536            ILMemoryPool.Pool.Free(work);
1537        }
1538        public void zhegv (int itype, char jobz, char uplo, int n, complex [] A, int lda, complex [] B, int ldb, double [] w, ref int info) {
1539            // query workspace
1540            int lwork = -1;
1541            complex [] work = new complex[1] {0.0f};
1542            double [] rwork = ILMemoryPool.Pool.New<double>(Math.Max(1,3*n-2));
1543            mkl_zhegv(ref itype,ref  jobz,ref  uplo,ref  n, A,ref  lda, B,ref  ldb, w, work, ref lwork, rwork, ref info);
1544            if (info != 0 || work[0] <= 0.0) return;
1545            // create temporary array(s)
1546            lwork = (int) work[0];
1547            work = ILMemoryPool.Pool.New<complex>(lwork);
1548            mkl_zhegv (ref itype,ref  jobz,ref  uplo,ref  n, A,ref  lda, B,ref  ldb, w, work, ref lwork, rwork, ref info);
1549            ILMemoryPool.Pool.Free(rwork);
1550            ILMemoryPool.Pool.Free(work);
1551        }
1552        #endregion
1553
1554        #endregion
1555    }
1556}
Note: See TracBrowser for help on using the repository browser.