Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GaussianProcessTuning/ILNumerics.2.14.4735.573/Native/lapack/ILLapackGeneric.cs @ 9844

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

#1967: ILNumerics source for experimentation

File size: 86.1 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 1591
41
42using System;
43using System.Collections.Generic;
44using System.Text;
45using ILNumerics.Native;
46using System.Runtime.InteropServices;
47using ILNumerics.Exceptions;
48using System.Security;
49using ILNumerics.Misc;
50
51namespace ILNumerics.Native  {
52    /// <summary>
53    /// Generic LAPACK implementation, unsupported processor types
54    /// </summary>
55  public class ILLapackGeneric : IILLapack {
56
57        #region DLL INCLUDES
58        [DllImport("lapack_gen", EntryPoint = "ilaenv"),SuppressUnmanagedCodeSecurity]
59        private static extern int lapack_ilaenv(ref int ispec, ref string name, ref string opts, ref int n1, ref int n2, ref int n3, ref int n4);
60
61        ///////////////////////////   DOUBLE LAPACK /////////////////////////////////
62        [DllImport("lapack_gen", EntryPoint = "dgemm"),SuppressUnmanagedCodeSecurity]
63        private static extern void lapack_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);
64        [DllImport("lapack_gen", EntryPoint = "sgemm"),SuppressUnmanagedCodeSecurity]
65    private static extern void lapack_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);
66        [DllImport("lapack_gen", EntryPoint = "cgemm"),SuppressUnmanagedCodeSecurity]
67    private static extern void lapack_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);
68        [DllImport("lapack_gen", EntryPoint = "zgemm"),SuppressUnmanagedCodeSecurity]
69    private static extern void lapack_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);
70
71        [DllImport("lapack_gen", EntryPoint = "dgesdd"),SuppressUnmanagedCodeSecurity]
72    private static extern void lapack_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);
73        [DllImport("lapack_gen", EntryPoint = "sgesdd"),SuppressUnmanagedCodeSecurity]
74    private static extern void lapack_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);
75        [DllImport("lapack_gen", EntryPoint = "cgesdd"),SuppressUnmanagedCodeSecurity]
76    private static extern void lapack_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);
77        [DllImport("lapack_gen", EntryPoint = "zgesdd"),SuppressUnmanagedCodeSecurity]
78    private static extern void lapack_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);
79
80        [DllImport("lapack_gen", EntryPoint = "dgesvd"),SuppressUnmanagedCodeSecurity]
81    private static extern void lapack_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);
82        [DllImport("lapack_gen", EntryPoint = "sgesvd"),SuppressUnmanagedCodeSecurity]
83    private static extern void lapack_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);
84        [DllImport("lapack_gen", EntryPoint = "cgesvd"),SuppressUnmanagedCodeSecurity]
85    private static extern void lapack_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);
86        [DllImport("lapack_gen", EntryPoint = "zgesvd"),SuppressUnmanagedCodeSecurity]
87    private static extern void lapack_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);
88
89        [DllImport("lapack_gen", EntryPoint = "dpotrf"),SuppressUnmanagedCodeSecurity]
90        private static extern void lapack_dpotrf (ref char uplo, ref int n, double [] A, ref int lda, ref int info);
91        [DllImport("lapack_gen", EntryPoint = "spotrf"),SuppressUnmanagedCodeSecurity]
92        private static extern void lapack_spotrf (ref char uplo, ref int n, float [] A, ref int lda, ref int info);
93        [DllImport("lapack_gen", EntryPoint = "cpotrf"),SuppressUnmanagedCodeSecurity]
94        private static extern void lapack_cpotrf (ref char uplo, ref int n,[In,Out] fcomplex [] A, ref int lda, ref int info);
95        [DllImport("lapack_gen", EntryPoint = "zpotrf"),SuppressUnmanagedCodeSecurity]
96        private static extern void lapack_zpotrf (ref char uplo, ref int n, [In,Out] complex [] A, ref int lda, ref int info);
97       
98        [DllImport("lapack_gen", EntryPoint = "dpotri"),SuppressUnmanagedCodeSecurity]
99        private static extern void lapack_dpotri (ref char uplo,ref  int n, double [] A, ref int lda, ref int info);
100        [DllImport("lapack_gen", EntryPoint = "spotri"),SuppressUnmanagedCodeSecurity]
101        private static extern void lapack_spotri (ref char uplo, ref int n, float [] A, ref int lda, ref int info);
102        [DllImport("lapack_gen", EntryPoint = "cpotri"),SuppressUnmanagedCodeSecurity]
103        private static extern void lapack_cpotri (ref char uplo, ref int n,[In,Out] fcomplex [] A, ref int lda,ref int info);
104        [DllImport("lapack_gen", EntryPoint = "zpotri"),SuppressUnmanagedCodeSecurity]
105        private static extern void lapack_zpotri (ref char uplo, ref int n, [In,Out] complex [] A, ref int lda,ref int info);
106
107        [DllImport("lapack_gen", EntryPoint = "dpotrs"),SuppressUnmanagedCodeSecurity]
108        private static extern void lapack_dpotrs (ref char uplo,ref  int n, ref int NRHS, double [] A, ref int lda, double[] B, ref int ldb, ref int info);
109        [DllImport("lapack_gen", EntryPoint = "spotrs"),SuppressUnmanagedCodeSecurity]
110        private static extern void lapack_spotrs (ref char uplo,ref  int n, ref int NRHS, float [] A, ref int lda, float[] B, ref int ldb, ref int info);
111        [DllImport("lapack_gen", EntryPoint = "cpotrs"),SuppressUnmanagedCodeSecurity]
112        private static extern void lapack_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);
113        [DllImport("lapack_gen", EntryPoint = "zpotrs"),SuppressUnmanagedCodeSecurity]
114        private static extern void lapack_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);
115
116        [DllImport("lapack_gen", EntryPoint = "dgetrf"),SuppressUnmanagedCodeSecurity]
117        private static extern void lapack_dgetrf (ref int M, ref int N, double [] A, ref int LDA, int[] IPIV, ref int info);
118        [DllImport("lapack_gen", EntryPoint = "sgetrf"),SuppressUnmanagedCodeSecurity]
119        private static extern void lapack_sgetrf (ref int M, ref int N, float[] A, ref int LDA, int [] IPIV, ref int info);
120        [DllImport("lapack_gen", EntryPoint = "cgetrf"),SuppressUnmanagedCodeSecurity]
121        private static extern void lapack_cgetrf (ref int M, ref int N, [In,Out] fcomplex [] A, ref int LDA, int [] IPIV, ref int info);
122        [DllImport("lapack_gen", EntryPoint = "zgetrf"),SuppressUnmanagedCodeSecurity]
123        private static extern void lapack_zgetrf (ref int M, ref int N, [In,Out] complex [] A, ref int LDA, int [] IPIV, ref int info);
124
125        [DllImport("lapack_gen", EntryPoint = "dgetri"),SuppressUnmanagedCodeSecurity]
126        private static extern void lapack_dgetri (ref int N, double[] A,ref  int LDA, int[] IPIV, double[] work, ref int lwork, ref int info);
127        [DllImport("lapack_gen", EntryPoint = "sgetri"),SuppressUnmanagedCodeSecurity]
128        private static extern void lapack_sgetri (ref int N, float [] A, ref int LDA, int [] IPIV, float[] work, ref int lwork, ref int info);
129        [DllImport("lapack_gen", EntryPoint = "cgetri"),SuppressUnmanagedCodeSecurity]
130        private static extern void lapack_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);
131        [DllImport("lapack_gen", EntryPoint = "zgetri"),SuppressUnmanagedCodeSecurity]
132        private static extern void lapack_zgetri (ref int N, [In,Out] complex [] A, ref int LDA, int [] IPIV, [In,Out] complex[] work, ref int lwork, ref int info);
133
134        [DllImport("lapack_gen", EntryPoint = "dgeqrf"),SuppressUnmanagedCodeSecurity]
135        private static extern void lapack_dgeqrf (ref int M, ref int N, double [] A, ref int lda, double [] tau, double[] work, ref int lwork, ref int info);
136        [DllImport("lapack_gen", EntryPoint = "sgeqrf"),SuppressUnmanagedCodeSecurity]
137        private static extern void lapack_sgeqrf (ref int M, ref int N, float [] A, ref int lda, float [] tau, float[] work, ref int lwork,  ref int info);
138        [DllImport("lapack_gen", EntryPoint = "cgeqrf"),SuppressUnmanagedCodeSecurity]
139        private static extern void lapack_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);
140        [DllImport("lapack_gen", EntryPoint = "zgeqrf"),SuppressUnmanagedCodeSecurity]
141        private static extern void lapack_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);
142
143        [DllImport("lapack_gen", EntryPoint = "dgeqp3"),SuppressUnmanagedCodeSecurity]
144        private static extern void lapack_dgeqp3 (ref int M, ref int N, double [] A, ref int LDA, int [] JPVT, double [] tau, double [] work, ref int lwork, ref int info );
145        [DllImport("lapack_gen", EntryPoint = "sgeqp3"),SuppressUnmanagedCodeSecurity]
146        private static extern void lapack_sgeqp3 (ref int M, ref int N, float [] A, ref int LDA, int [] JPVT, float [] tau, float [] work, ref int lwork, ref int info );
147        [DllImport("lapack_gen", EntryPoint = "cgeqp3"),SuppressUnmanagedCodeSecurity]
148        private static extern void lapack_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 );
149        [DllImport("lapack_gen", EntryPoint = "zgeqp3"),SuppressUnmanagedCodeSecurity]
150        private static extern void lapack_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 );
151
152        [DllImport("lapack_gen", EntryPoint = "dormqr"),SuppressUnmanagedCodeSecurity]
153        private static extern void lapack_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);
154        [DllImport("lapack_gen", EntryPoint = "sormqr"),SuppressUnmanagedCodeSecurity]
155        private static extern void lapack_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);
156       
157        [DllImport("lapack_gen", EntryPoint = "dorgqr"),SuppressUnmanagedCodeSecurity]
158        private static extern void lapack_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);
159        [DllImport("lapack_gen", EntryPoint = "sorgqr"),SuppressUnmanagedCodeSecurity]
160        private static extern void lapack_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);
161        [DllImport("lapack_gen", EntryPoint = "cungqr"),SuppressUnmanagedCodeSecurity]
162        private static extern void lapack_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);
163        [DllImport("lapack_gen", EntryPoint = "zungqr"),SuppressUnmanagedCodeSecurity]
164        private static extern void lapack_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);
165       
166        [DllImport("lapack_gen", EntryPoint = "dtrtrs"),SuppressUnmanagedCodeSecurity]
167        private static extern void lapack_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);
168        [DllImport("lapack_gen", EntryPoint = "strtrs"),SuppressUnmanagedCodeSecurity]
169        private static extern void lapack_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);
170        [DllImport("lapack_gen", EntryPoint = "ctrtrs"),SuppressUnmanagedCodeSecurity]
171        private static extern void lapack_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);
172        [DllImport("lapack_gen", EntryPoint = "ztrtrs"),SuppressUnmanagedCodeSecurity]
173        private static extern void lapack_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);
174       
175        [DllImport("lapack_gen", EntryPoint = "dgetrs"),SuppressUnmanagedCodeSecurity]
176        private static extern void lapack_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);
177        [DllImport("lapack_gen", EntryPoint = "sgetrs"),SuppressUnmanagedCodeSecurity]
178        private static extern void lapack_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);
179        [DllImport("lapack_gen", EntryPoint = "cgetrs"),SuppressUnmanagedCodeSecurity]
180        private static extern void lapack_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);
181        [DllImport("lapack_gen", EntryPoint = "zgetrs"),SuppressUnmanagedCodeSecurity]
182        private static extern void lapack_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);
183
184        [DllImport("lapack_gen", EntryPoint = "dgelsd"),SuppressUnmanagedCodeSecurity]
185        private static extern void lapack_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);
186        [DllImport("lapack_gen", EntryPoint = "sgelsd"),SuppressUnmanagedCodeSecurity]
187        private static extern void lapack_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);
188        [DllImport("lapack_gen", EntryPoint = "cgelsd"),SuppressUnmanagedCodeSecurity]
189        private static extern void lapack_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);
190        [DllImport("lapack_gen", EntryPoint = "zgelsd"),SuppressUnmanagedCodeSecurity]
191        private static extern void lapack_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);
192       
193        [DllImport("lapack_gen", EntryPoint = "dgelsy"),SuppressUnmanagedCodeSecurity]
194        private static extern void lapack_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);
195        [DllImport("lapack_gen", EntryPoint = "sgelsy"),SuppressUnmanagedCodeSecurity]
196        private static extern void lapack_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);
197        [DllImport("lapack_gen", EntryPoint = "cgelsy"),SuppressUnmanagedCodeSecurity]
198        private static extern void lapack_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);
199        [DllImport("lapack_gen", EntryPoint = "zgelsy"),SuppressUnmanagedCodeSecurity]
200        private static extern void lapack_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);
201       
202        [DllImport("lapack_gen", EntryPoint = "dgeevx"),SuppressUnmanagedCodeSecurity]
203        private static extern void lapack_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);
204        [DllImport("lapack_gen", EntryPoint = "sgeevx"),SuppressUnmanagedCodeSecurity]
205        private static extern void lapack_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);
206        [DllImport("lapack_gen", EntryPoint = "cgeevx"),SuppressUnmanagedCodeSecurity]
207        private static extern void lapack_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);
208        [DllImport("lapack_gen", EntryPoint = "zgeevx"),SuppressUnmanagedCodeSecurity]
209        private static extern void lapack_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);
210
211        [DllImport("lapack_gen", EntryPoint = "dsyevr"),SuppressUnmanagedCodeSecurity]
212        private static extern void lapack_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);
213        [DllImport("lapack_gen", EntryPoint = "ssyevr"),SuppressUnmanagedCodeSecurity]                                                                                                                                                                                                                                         
214        private static extern void lapack_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);
215        [DllImport("lapack_gen", EntryPoint = "cheevr"),SuppressUnmanagedCodeSecurity]                                                                                                                                                                                                                                         
216        private static extern void lapack_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);
217        [DllImport("lapack_gen", EntryPoint = "zheevr"),SuppressUnmanagedCodeSecurity]                                                                                                                                                                                                                                         
218        private static extern void lapack_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);
219
220        [DllImport("lapack_gen", EntryPoint = "dsygv"),SuppressUnmanagedCodeSecurity]
221        private static extern void lapack_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);
222        [DllImport("lapack_gen", EntryPoint = "ssygv"),SuppressUnmanagedCodeSecurity]
223        private static extern void lapack_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);
224        [DllImport("lapack_gen", EntryPoint = "chegv"),SuppressUnmanagedCodeSecurity]
225        private static extern void lapack_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);
226        [DllImport("lapack_gen", EntryPoint = "zhegv"),SuppressUnmanagedCodeSecurity]
227        private static extern void lapack_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);
228
229#endregion DLL INCLUDES
230
231        #region ILLAPACK INTERFACE
232
233        private int ILAENV (int ispec, string name, string opts, int n1, int n2, int n3, int n4) {
234            return lapack_ilaenv(ref ispec, ref name, ref opts, ref n1, ref n2, ref n3, ref n4);
235        }
236
237        /// <summary>
238        /// Implement wrapper for ATLAS GeneralMatrixMultiply
239        /// </summary>
240        /// <param name="TransA">Transposition state for matrix A: one of the constants in enum CBlas_Transpose</param>
241        /// <param name="TransB">Transposition state for matrix B: one of the constants in enum CBlas_Transpose</param>
242        /// <param name="M">Number of rows in A</param>
243        /// <param name="N">Number of columns in B</param>
244        /// <param name="K">Number of columns in A and number of rows in B</param>
245        /// <param name="alpha">multiplicationi factor for A</param>
246        /// <param name="A">pointer to double array A</param>
247        /// <param name="lda">distance between first elements of each column for column based orientation or
248        /// distance between first elements of each row for row based orientation for matrix B</param>
249        /// <param name="B">pointer to double array B</param>
250        /// <param name="ldb">distance between first elements of each column for column based orientation or
251        /// distance between first elements of each row for row based orientation for matrix A</param>
252        /// <param name="beta">multiplication faktor for matrix B</param>
253        /// <param name="C">pointer to predefined double array C of neccessary length</param>
254        /// <param name="ldc">distance between first elements of each column for column based orientation or
255        /// distance between first elements of each row for row based orientation for matrix C</param>
256        /// <remarks>All parameters except C are readonly. Only elements of matrix C will be altered. C must be a predefined
257        /// continous double array of size MxN</remarks>
258        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) {
259            lapack_dgemm(ref TransA, ref TransB, ref M, ref  N, ref  K, ref  alpha, A, ref lda, B, ref ldb, ref  beta, C, ref  ldc);
260        }
261        /// <summary>
262        /// Implement wrapper for ATLAS GeneralMatrixMultiply
263        /// </summary>
264        /// <param name="TransA">Transposition state for matrix A: one of the constants in enum CBlas_Transpose</param>
265        /// <param name="TransB">Transposition state for matrix B: one of the constants in enum CBlas_Transpose</param>
266        /// <param name="M">Number of rows in A</param>
267        /// <param name="N">Number of columns in B</param>
268        /// <param name="K">Number of columns in A and number of rows in B</param>
269        /// <param name="alpha">multiplicationi factor for A</param>
270        /// <param name="A">pointer to double array A</param>
271        /// <param name="lda">distance between first elements of each column for column based orientation or
272        /// distance between first elements of each row for row based orientation for matrix B</param>
273        /// <param name="B">pointer to double array B</param>
274        /// <param name="ldb">distance between first elements of each column for column based orientation or
275        /// distance between first elements of each row for row based orientation for matrix A</param>
276        /// <param name="beta">multiplication faktor for matrix B</param>
277        /// <param name="C">pointer to predefined double array C of neccessary length</param>
278        /// <param name="ldc">distance between first elements of each column for column based orientation or
279        /// distance between first elements of each row for row based orientation for matrix C</param>
280        /// <remarks>All parameters except C are readonly. Only elements of matrix C will be altered. C must be a predefined
281        /// continous double array of size MxN</remarks>
282        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) {
283            lapack_sgemm(ref TransA, ref TransB, ref M, ref  N, ref  K, ref  alpha, A, ref lda, B, ref ldb, ref  beta, C, ref  ldc);
284        }
285        /// <summary>
286        /// Implement wrapper for ATLAS GeneralMatrixMultiply
287        /// </summary>
288        /// <param name="TransA">Transposition state for matrix A: one of the constants in enum CBlas_Transpose</param>
289        /// <param name="TransB">Transposition state for matrix B: one of the constants in enum CBlas_Transpose</param>
290        /// <param name="M">Number of rows in A</param>
291        /// <param name="N">Number of columns in B</param>
292        /// <param name="K">Number of columns in A and number of rows in B</param>
293        /// <param name="alpha">multiplicationi factor for A</param>
294        /// <param name="A">pointer to double array A</param>
295        /// <param name="lda">distance between first elements of each column for column based orientation or
296        /// distance between first elements of each row for row based orientation for matrix B</param>
297        /// <param name="B">pointer to double array B</param>
298        /// <param name="ldb">distance between first elements of each column for column based orientation or
299        /// distance between first elements of each row for row based orientation for matrix A</param>
300        /// <param name="beta">multiplication faktor for matrix B</param>
301        /// <param name="C">pointer to predefined double array C of neccessary length</param>
302        /// <param name="ldc">distance between first elements of each column for column based orientation or
303        /// distance between first elements of each row for row based orientation for matrix C</param>
304        /// <remarks>All parameters except C are readonly. Only elements of matrix C will be altered. C must be a predefined
305        /// continous double array of size MxN</remarks>
306        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) {
307            lapack_cgemm(ref TransA, ref TransB, ref M, ref  N, ref  K, ref  alpha, A, ref lda, B, ref ldb, ref  beta, C, ref  ldc);
308        }
309        /// <summary>
310        /// Implement wrapper for ATLAS GeneralMatrixMultiply
311        /// </summary>
312        /// <param name="TransA">Transposition state for matrix A: one of the constants in enum CBlas_Transpose</param>
313        /// <param name="TransB">Transposition state for matrix B: one of the constants in enum CBlas_Transpose</param>
314        /// <param name="M">Number of rows in A</param>
315        /// <param name="N">Number of columns in B</param>
316        /// <param name="K">Number of columns in A and number of rows in B</param>
317        /// <param name="alpha">multiplicationi factor for A</param>
318        /// <param name="A">pointer to double array A</param>
319        /// <param name="lda">distance between first elements of each column for column based orientation or
320        /// distance between first elements of each row for row based orientation for matrix B</param>
321        /// <param name="B">pointer to double array B</param>
322        /// <param name="ldb">distance between first elements of each column for column based orientation or
323        /// distance between first elements of each row for row based orientation for matrix A</param>
324        /// <param name="beta">multiplication faktor for matrix B</param>
325        /// <param name="C">pointer to predefined double array C of neccessary length</param>
326        /// <param name="ldc">distance between first elements of each column for column based orientation or
327        /// distance between first elements of each row for row based orientation for matrix C</param>
328        /// <remarks>All parameters except C are readonly. Only elements of matrix C will be altered. C must be a predefined
329        /// continous double array of size MxN</remarks>
330        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) {
331            lapack_zgemm(ref TransA, ref TransB, ref M, ref  N, ref  K, ref  alpha, A, ref lda, B, ref ldb, ref  beta, C, ref  ldc);
332        }
333
334
335       
336        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) {
337            try {
338                 double [] work = new  double [1] { ( double )0.0 };
339                int lwork = -1;
340                int[] iwork = new int[((m < n) ? m : n) * 8];
341                 lapack_dgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
342                if (work[0] != 0) {
343                    work = new  double [(int)work[0]];
344                    lwork = work.Length;
345                     lapack_dgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
346                }
347            } catch (Exception e) {
348                if (e is OutOfMemoryException) {
349                     dgesvd (jobz, m, n, a, lda, s, u, ldu, vt, ldvt, ref info);
350                }
351                throw new ILException("Unable to do " +  "dgesdd"  + ".", e);
352            }
353        }
354
355#region HYCALPER AUTO GENERATED CODE
356
357       
358        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) {
359            try {
360                float [] work = new  float [1] { ( float )0.0 };
361                int lwork = -1;
362                int[] iwork = new int[((m < n) ? m : n) * 8];
363                lapack_sgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
364                if (work[0] != 0) {
365                    work = new  float [(int)work[0]];
366                    lwork = work.Length;
367                    lapack_sgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, iwork, ref info);
368                }
369            } catch (Exception e) {
370                if (e is OutOfMemoryException) {
371                    sgesvd (jobz, m, n, a, lda, s, u, ldu, vt, ldvt, ref info);
372                }
373                throw new ILException("Unable to do " +  "sgesdd"  + ".", e);
374            }
375        }
376
377#endregion HYCALPER AUTO GENERATED CODE
378
379
380
381        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)
382        {
383            try {
384                 complex [] work = new  complex [1] { (  complex )0.0 };
385                 double [] rwork;
386                int minMN = (m < n) ? m : n;
387                if (jobz == 'N') {
388                    rwork = new  double [minMN * 7]; 
389                } else {
390                    rwork = new  double [5 * minMN * minMN + 5 * minMN]; 
391                }
392                int lwork = -1;
393                int[] iwork = new int[minMN * 8];
394                 lapack_zgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, rwork, iwork, ref info);
395                if (work[0] != 0) {
396                    work = new  complex [(int)work[0].real];
397                    lwork = work.Length;
398                     lapack_zgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork,rwork, iwork, ref info);
399                }
400            } catch (Exception e) {
401                if (e is OutOfMemoryException) {
402                     zgesvd (jobz, m, n, a, lda, s, u, ldu, vt, ldvt, ref info);
403                }
404                throw new ILException("Unable to do " +  "zgesdd"  + ".", e);
405            }
406        }
407
408#region HYCALPER AUTO GENERATED CODE
409
410
411        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)
412        {
413            try {
414                fcomplex [] work = new  fcomplex [1] { (  fcomplex )0.0 };
415                float [] rwork;
416                int minMN = (m < n) ? m : n;
417                if (jobz == 'N') {
418                    rwork = new  float [minMN * 7]; 
419                } else {
420                    rwork = new  float [5 * minMN * minMN + 5 * minMN]; 
421                }
422                int lwork = -1;
423                int[] iwork = new int[minMN * 8];
424                lapack_cgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork, rwork, iwork, ref info);
425                if (work[0] != 0) {
426                    work = new  fcomplex [(int)work[0].real];
427                    lwork = work.Length;
428                    lapack_cgesdd (ref jobz, ref m, ref n, a, ref lda, s, u, ref ldu, vt, ref ldvt, work, ref lwork,rwork, iwork, ref info);
429                }
430            } catch (Exception e) {
431                if (e is OutOfMemoryException) {
432                    cgesvd (jobz, m, n, a, lda, s, u, ldu, vt, ldvt, ref info);
433                }
434                throw new ILException("Unable to do " +  "zgesdd"  + ".", e);
435            }
436        }
437
438#endregion HYCALPER AUTO GENERATED CODE
439
440
441       
442
443        /// <summary>
444        /// singular value decomposition
445        /// </summary>
446        /// <param name="jobz"></param>
447        /// <param name="m"></param>
448        /// <param name="n"></param>
449        /// <param name="a"></param>
450        /// <param name="lda"></param>
451        /// <param name="s"></param>
452        /// <param name="u"></param>
453        /// <param name="ldu"></param>
454        /// <param name="vt"></param>
455        /// <param name="ldvt"></param>
456        /// <param name="info"></param>
457        public void  dgesvd (char jobz, int m, int n,  double [] a, int lda,
458                            double [] s,  double [] u, int ldu,  double [] vt, int ldvt, ref int info) {
459            if (jobz != 'A' && jobz != 'S' && jobz != 'N')
460                throw new ILArgumentException("Argument jobz must be one of 'A','S' or 'N'");
461            try {
462                 double [] work = new  double [1] { ( double )0.0 };
463                int lwork = -1;
464                int[] iwork = new int[((m < n) ? m : n) * 8];
465                 lapack_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);
466                if (work[0] != 0) {
467                    work = new  double [(int)work[0]];
468                    lwork = work.Length;
469                     lapack_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);
470                }
471            } catch (Exception e) {
472                if (e is OutOfMemoryException) {
473                    throw new ILMemoryException("Not enough memory for given arguments.");
474                }
475                throw new ILException("Unable to do gesvd.", e);
476            }
477        }
478
479#region HYCALPER AUTO GENERATED CODE
480
481       
482
483        /// <summary>
484        /// singular value decomposition
485        /// </summary>
486        /// <param name="jobz"></param>
487        /// <param name="m"></param>
488        /// <param name="n"></param>
489        /// <param name="a"></param>
490        /// <param name="lda"></param>
491        /// <param name="s"></param>
492        /// <param name="u"></param>
493        /// <param name="ldu"></param>
494        /// <param name="vt"></param>
495        /// <param name="ldvt"></param>
496        /// <param name="info"></param>
497        public void  sgesvd (char jobz, int m, int n,  float [] a, int lda,
498                           float [] s,  float [] u, int ldu,  float [] vt, int ldvt, ref int info) {
499            if (jobz != 'A' && jobz != 'S' && jobz != 'N')
500                throw new ILArgumentException("Argument jobz must be one of 'A','S' or 'N'");
501            try {
502                float [] work = new  float [1] { ( float )0.0 };
503                int lwork = -1;
504                int[] iwork = new int[((m < n) ? m : n) * 8];
505                lapack_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);
506                if (work[0] != 0) {
507                    work = new  float [(int)work[0]];
508                    lwork = work.Length;
509                    lapack_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);
510                }
511            } catch (Exception e) {
512                if (e is OutOfMemoryException) {
513                    throw new ILMemoryException("Not enough memory for given arguments.");
514                }
515                throw new ILException("Unable to do gesvd.", e);
516            }
517        }
518       
519
520        /// <summary>
521        /// singular value decomposition
522        /// </summary>
523        /// <param name="jobz"></param>
524        /// <param name="m"></param>
525        /// <param name="n"></param>
526        /// <param name="a"></param>
527        /// <param name="lda"></param>
528        /// <param name="s"></param>
529        /// <param name="u"></param>
530        /// <param name="ldu"></param>
531        /// <param name="vt"></param>
532        /// <param name="ldvt"></param>
533        /// <param name="info"></param>
534        public void  zgesvd (char jobz, int m, int n,  complex [] a, int lda,
535                           double [] s,  complex [] u, int ldu,  complex [] vt, int ldvt, ref int info) {
536            if (jobz != 'A' && jobz != 'S' && jobz != 'N')
537                throw new ILArgumentException("Argument jobz must be one of 'A','S' or 'N'");
538            try {
539                complex [] work = new  complex [1] { ( complex )0.0 };
540                int lwork = -1;
541                int[] iwork = new int[((m < n) ? m : n) * 8];
542                lapack_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);
543                if (work[0] != 0) {
544                    work = new  complex [(int)work[0]];
545                    lwork = work.Length;
546                    lapack_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);
547                }
548            } catch (Exception e) {
549                if (e is OutOfMemoryException) {
550                    throw new ILMemoryException("Not enough memory for given arguments.");
551                }
552                throw new ILException("Unable to do gesvd.", e);
553            }
554        }
555       
556
557        /// <summary>
558        /// singular value decomposition
559        /// </summary>
560        /// <param name="jobz"></param>
561        /// <param name="m"></param>
562        /// <param name="n"></param>
563        /// <param name="a"></param>
564        /// <param name="lda"></param>
565        /// <param name="s"></param>
566        /// <param name="u"></param>
567        /// <param name="ldu"></param>
568        /// <param name="vt"></param>
569        /// <param name="ldvt"></param>
570        /// <param name="info"></param>
571        public void  cgesvd (char jobz, int m, int n,  fcomplex [] a, int lda,
572                           float [] s,  fcomplex [] u, int ldu,  fcomplex [] vt, int ldvt, ref int info) {
573            if (jobz != 'A' && jobz != 'S' && jobz != 'N')
574                throw new ILArgumentException("Argument jobz must be one of 'A','S' or 'N'");
575            try {
576                fcomplex [] work = new  fcomplex [1] { ( fcomplex )0.0 };
577                int lwork = -1;
578                int[] iwork = new int[((m < n) ? m : n) * 8];
579                lapack_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);
580                if (work[0] != 0) {
581                    work = new  fcomplex [(int)work[0]];
582                    lwork = work.Length;
583                    lapack_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);
584                }
585            } catch (Exception e) {
586                if (e is OutOfMemoryException) {
587                    throw new ILMemoryException("Not enough memory for given arguments.");
588                }
589                throw new ILException("Unable to do gesvd.", e);
590            }
591        }
592
593#endregion HYCALPER AUTO GENERATED CODE
594
595        public void dpotrf(char uplo, int n, double[] A, int lda, ref int info) {
596            lapack_dpotrf(ref uplo, ref n, A, ref lda, ref info);
597        }
598        public void spotrf(char uplo, int n, float[] A, int lda, ref int info) {
599            lapack_spotrf(ref uplo, ref n, A, ref lda, ref info);
600        }
601        public void cpotrf(char uplo, int n, fcomplex[] A, int lda, ref int info) {
602            lapack_cpotrf(ref uplo, ref n, A, ref lda, ref info);
603        }
604        public void zpotrf(char uplo, int n, complex[] A, int lda, ref int info) {
605            lapack_zpotrf(ref uplo, ref n, A, ref lda, ref info);
606        }
607
608
609        public void dpotri(char uplo, int n, double[] A, int lda, ref int info) {
610            lapack_dpotri(ref uplo, ref n, A, ref lda, ref info);
611        }
612        public void spotri(char uplo, int n, float[] A, int lda, ref int info) {
613            lapack_spotri(ref uplo, ref n, A, ref lda, ref info);
614        }
615        public void cpotri(char uplo, int n, fcomplex[] A, int lda, ref int info) {
616            lapack_cpotri(ref uplo, ref n, A, ref lda, ref info);
617        }
618        public void zpotri(char uplo, int n, complex[] A, int lda, ref int info) {
619            lapack_zpotri(ref uplo, ref n, A, ref lda, ref info);
620        }
621
622
623        public void dgetrf(int M, int N, double[] A, int LDA, int[] IPIV, ref int info) {
624            lapack_dgetrf(ref M, ref N, A, ref LDA, IPIV, ref info);
625        }
626        public void sgetrf(int M, int N, float[] A, int LDA, int[] IPIV, ref int info) {
627            lapack_sgetrf(ref M, ref N, A, ref LDA, IPIV, ref info);
628        }
629        public void cgetrf(int M, int N, fcomplex[] A, int LDA, int[] IPIV, ref int info) {
630            lapack_cgetrf(ref M, ref N, A, ref LDA, IPIV, ref info);
631        }
632        public void zgetrf(int M, int N, complex[] A, int LDA, int[] IPIV, ref int info) {
633            lapack_zgetrf(ref M, ref N, A, ref LDA, IPIV, ref info);
634        }
635
636
637       
638        public void  dgetri (int N,  double [] A, int LDA, int[] IPIV, ref int info) {
639             double [] work = new  double [1]; 
640            int lwork = -1;
641            try {
642                 lapack_dgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
643                lwork = (int)work[0];
644                if (lwork > 0 && info == 0) {
645                    work = new  double [lwork];
646                     lapack_dgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
647                } else {
648                    throw new ILException("error in lapack_dgetri");
649                }
650            } catch (OutOfMemoryException e) {
651                throw new ILException("error on dgetri. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
652            }
653        }
654
655#region HYCALPER AUTO GENERATED CODE
656
657       
658        public void  sgetri (int N,  float [] A, int LDA, int[] IPIV, ref int info) {
659            float [] work = new  float [1]; 
660            int lwork = -1;
661            try {
662                lapack_sgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
663                lwork = (int)work[0];
664                if (lwork > 0 && info == 0) {
665                    work = new  float [lwork];
666                    lapack_sgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
667                } else {
668                    throw new ILException("error in lapack_dgetri");
669                }
670            } catch (OutOfMemoryException e) {
671                throw new ILException("error on dgetri. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
672            }
673        }
674       
675        public void  zgetri (int N,  complex [] A, int LDA, int[] IPIV, ref int info) {
676            complex [] work = new  complex [1]; 
677            int lwork = -1;
678            try {
679                lapack_zgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
680                lwork = (int)work[0];
681                if (lwork > 0 && info == 0) {
682                    work = new  complex [lwork];
683                    lapack_zgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
684                } else {
685                    throw new ILException("error in lapack_dgetri");
686                }
687            } catch (OutOfMemoryException e) {
688                throw new ILException("error on dgetri. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
689            }
690        }
691       
692        public void  cgetri (int N,  fcomplex [] A, int LDA, int[] IPIV, ref int info) {
693            fcomplex [] work = new  fcomplex [1]; 
694            int lwork = -1;
695            try {
696                lapack_cgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
697                lwork = (int)work[0];
698                if (lwork > 0 && info == 0) {
699                    work = new  fcomplex [lwork];
700                    lapack_cgetri (ref N, A, ref LDA, IPIV, work, ref lwork, ref info);
701                } else {
702                    throw new ILException("error in lapack_dgetri");
703                }
704            } catch (OutOfMemoryException e) {
705                throw new ILException("error on dgetri. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
706            }
707        }
708
709#endregion HYCALPER AUTO GENERATED CODE
710
711
712       
713        public void  dgeqrf (int M, int N,  double [] A, int lda,  double [] tau, ref int info) {
714             double [] work = new  double [1]; 
715            int lwork = -1;
716            try {
717                 lapack_dgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
718                lwork = (int)work[0];
719                if (lwork > 0 && info == 0) {
720                    work = new  double [lwork];
721                     lapack_dgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
722                } else {
723                    throw new ILException("error in lapack_?geqrf");
724                }
725            } catch (OutOfMemoryException e) {
726                throw new ILException("error on ?geqrf. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
727            }
728        }
729
730#region HYCALPER AUTO GENERATED CODE
731
732       
733        public void  sgeqrf (int M, int N,  float [] A, int lda,  float [] tau, ref int info) {
734            float [] work = new  float [1]; 
735            int lwork = -1;
736            try {
737                lapack_sgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
738                lwork = (int)work[0];
739                if (lwork > 0 && info == 0) {
740                    work = new  float [lwork];
741                    lapack_sgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
742                } else {
743                    throw new ILException("error in lapack_?geqrf");
744                }
745            } catch (OutOfMemoryException e) {
746                throw new ILException("error on ?geqrf. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
747            }
748        }
749       
750        public void  zgeqrf (int M, int N,  complex [] A, int lda,  complex [] tau, ref int info) {
751            complex [] work = new  complex [1]; 
752            int lwork = -1;
753            try {
754                lapack_zgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
755                lwork = (int)work[0];
756                if (lwork > 0 && info == 0) {
757                    work = new  complex [lwork];
758                    lapack_zgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
759                } else {
760                    throw new ILException("error in lapack_?geqrf");
761                }
762            } catch (OutOfMemoryException e) {
763                throw new ILException("error on ?geqrf. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
764            }
765        }
766       
767        public void  cgeqrf (int M, int N,  fcomplex [] A, int lda,  fcomplex [] tau, ref int info) {
768            fcomplex [] work = new  fcomplex [1]; 
769            int lwork = -1;
770            try {
771                lapack_cgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
772                lwork = (int)work[0];
773                if (lwork > 0 && info == 0) {
774                    work = new  fcomplex [lwork];
775                    lapack_cgeqrf (ref M, ref N, A, ref lda, tau, work, ref lwork, ref info);
776                } else {
777                    throw new ILException("error in lapack_?geqrf");
778                }
779            } catch (OutOfMemoryException e) {
780                throw new ILException("error on ?geqrf. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
781            }
782        }
783
784#endregion HYCALPER AUTO GENERATED CODE
785
786        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) {
787            throw new Exception("The method or operation is not implemented.");
788        }
789        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) {
790            throw new Exception("The method or operation is not implemented.");
791        }
792
793
794       
795        public void  dorgqr (int M, int N, int K,  double [] A, int lda,  double [] tau, ref int info) {
796             double [] work = new  double [1]; 
797            int lwork = -1;
798            try {
799                /*!HC:lapack_***gqr*/ lapack_dorgqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
800                lwork = (int)work[0];
801                if (lwork > 0 && info == 0) {
802                    work = new  double [lwork];
803                    /*!HC:lapack_***gqr*/ lapack_dorgqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
804                } else {
805                    throw new ILException("error in lapack_?[un/or]gqr");
806                }
807            } catch (OutOfMemoryException e) {
808                throw new ILException("error on ?[un/or]gqr. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
809            }
810        }
811
812#region HYCALPER AUTO GENERATED CODE
813
814       
815        public void  sorgqr (int M, int N, int K,  float [] A, int lda,  float [] tau, ref int info) {
816            float [] work = new  float [1]; 
817            int lwork = -1;
818            try {
819                lapack_sorgqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
820                lwork = (int)work[0];
821                if (lwork > 0 && info == 0) {
822                    work = new  float [lwork];
823                    lapack_sorgqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
824                } else {
825                    throw new ILException("error in lapack_?[un/or]gqr");
826                }
827            } catch (OutOfMemoryException e) {
828                throw new ILException("error on ?[un/or]gqr. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
829            }
830        }
831       
832        public void  zungqr (int M, int N, int K,  complex [] A, int lda,  complex [] tau, ref int info) {
833            complex [] work = new  complex [1]; 
834            int lwork = -1;
835            try {
836                lapack_zungqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
837                lwork = (int)work[0];
838                if (lwork > 0 && info == 0) {
839                    work = new  complex [lwork];
840                    lapack_zungqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
841                } else {
842                    throw new ILException("error in lapack_?[un/or]gqr");
843                }
844            } catch (OutOfMemoryException e) {
845                throw new ILException("error on ?[un/or]gqr. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
846            }
847        }
848       
849        public void  cungqr (int M, int N, int K,  fcomplex [] A, int lda,  fcomplex [] tau, ref int info) {
850            fcomplex [] work = new  fcomplex [1]; 
851            int lwork = -1;
852            try {
853                lapack_cungqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
854                lwork = (int)work[0];
855                if (lwork > 0 && info == 0) {
856                    work = new  fcomplex [lwork];
857                    lapack_cungqr (ref M, ref N, ref K, A, ref lda, tau, work, ref lwork, ref info);
858                } else {
859                    throw new ILException("error in lapack_?[un/or]gqr");
860                }
861            } catch (OutOfMemoryException e) {
862                throw new ILException("error on ?[un/or]gqr. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
863            }
864        }
865
866#endregion HYCALPER AUTO GENERATED CODE
867
868
869       
870        public void  dgeqp3 ( int M,int N, double [] A,int LDA,int [] JPVT, double [] tau, ref int info ) {
871             double [] work = new  double [1];
872            int lwork = -1;
873            try {
874                 
875                /*dummy*/
876                 
877                lapack_dgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, ref info);
878                lwork = (int)work[0];
879                if (lwork > 0 && info == 0) {
880                    work = new  double [lwork];
881                     
882                    lapack_dgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, ref info);
883                } else {
884                    throw new ILException("error in lapack_?geqp3");
885                }
886            } catch (OutOfMemoryException e) {
887                throw new ILException("error on ?geqp3. 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  sgeqp3 ( int M,int N, float [] A,int LDA,int [] JPVT, float [] tau, ref int info ) {
895            float [] work = new  float [1];
896            int lwork = -1;
897            try {
898               
899                lapack_sgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, ref info);
900                lwork = (int)work[0];
901                if (lwork > 0 && info == 0) {
902                    work = new  float [lwork];
903                    lapack_sgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, ref info);
904                } else {
905                    throw new ILException("error in lapack_?geqp3");
906                }
907            } catch (OutOfMemoryException e) {
908                throw new ILException("error on ?geqp3. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
909            }
910        }
911       
912        public void  zgeqp3 ( int M,int N, complex [] A,int LDA,int [] JPVT, complex [] tau, ref int info ) {
913            complex [] work = new  complex [1];
914            int lwork = -1;
915            try {
916                double[] rwork = new double[2 * N];
917                lapack_zgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, rwork, ref info);
918                lwork = (int)work[0];
919                if (lwork > 0 && info == 0) {
920                    work = new  complex [lwork];
921                    lapack_zgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, rwork, ref info);
922                } else {
923                    throw new ILException("error in lapack_?geqp3");
924                }
925            } catch (OutOfMemoryException e) {
926                throw new ILException("error on ?geqp3. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
927            }
928        }
929       
930        public void  cgeqp3 ( int M,int N, fcomplex [] A,int LDA,int [] JPVT, fcomplex [] tau, ref int info ) {
931            fcomplex [] work = new  fcomplex [1];
932            int lwork = -1;
933            try {
934                float[] rwork = new float[2 * N];
935                lapack_cgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, rwork, ref info);
936                lwork = (int)work[0];
937                if (lwork > 0 && info == 0) {
938                    work = new  fcomplex [lwork];
939                    lapack_cgeqp3 (ref M, ref N, A, ref LDA, JPVT, tau, work, ref lwork, rwork, ref info);
940                } else {
941                    throw new ILException("error in lapack_?geqp3");
942                }
943            } catch (OutOfMemoryException e) {
944                throw new ILException("error on ?geqp3. Not enough memory! " + (lwork * Marshal.SizeOf( work[0] )).ToString() + " bytes has been requested.",e);
945            }
946        }
947
948#endregion HYCALPER AUTO GENERATED CODE
949
950        public void dtrtrs(char uplo, char transA, char diag, int N, int nrhs, IntPtr A, int LDA, IntPtr B, int LDB, ref int info) {
951            lapack_dtrtrs(ref uplo, ref transA, ref diag, ref N, ref nrhs, A, ref LDA, B, ref LDB, ref info);
952        }
953        public void strtrs(char uplo, char transA, char diag, int N, int nrhs, IntPtr A, int LDA, IntPtr B, int LDB, ref int info) {
954            lapack_strtrs(ref uplo, ref transA, ref diag, ref N, ref nrhs, A, ref LDA, B, ref LDB, ref info);
955        }
956        public void ctrtrs(char uplo, char transA, char diag, int N, int nrhs, IntPtr A, int LDA, IntPtr B, int LDB, ref int info) {
957            lapack_ctrtrs(ref uplo, ref transA, ref diag, ref N, ref nrhs, A, ref LDA, B, ref LDB, ref info);
958        }
959        public void ztrtrs(char uplo, char transA, char diag, int N, int nrhs, IntPtr A, int LDA, IntPtr B, int LDB, ref int info) {
960            lapack_ztrtrs(ref uplo, ref transA, ref diag, ref N, ref nrhs, A, ref LDA, B, ref LDB, ref info);
961        }
962
963        public void dgetrs(char trans, int N, int NRHS, double[] A, int LDA, int[] IPIV, double[] B, int LDB, ref int info) {
964            lapack_dgetrs(ref trans,ref N,ref NRHS, A, ref LDA, IPIV, B, ref LDB, ref info);     
965        }
966
967        public void sgetrs(char trans, int N, int NRHS, float[] A, int LDA, int[] IPIV, float[] B, int LDB, ref int info) {
968            lapack_sgetrs(ref trans,ref N,ref NRHS, A, ref LDA, IPIV, B, ref LDB, ref info);     
969        }
970
971        public void cgetrs(char trans, int N, int NRHS, fcomplex[] A, int LDA, int[] IPIV, fcomplex[] B, int LDB, ref int info) {
972            lapack_cgetrs(ref trans,ref N,ref NRHS, A, ref LDA, IPIV, B, ref LDB, ref info);     
973        }
974
975        public void zgetrs(char trans, int N, int NRHS, complex[] A, int LDA, int[] IPIV, complex[] B, int LDB, ref int info) {
976            lapack_zgetrs(ref trans,ref N,ref NRHS, A, ref LDA, IPIV, B, ref LDB, ref info);
977        }
978       
979        public void dpotrs(char uplo, int n, int nrhs, double[] A, int lda, double[] B, int ldb, ref int info) {
980            lapack_dpotrs(ref uplo, ref n, ref nrhs, A, ref lda, B, ref ldb, ref info);
981        }
982
983        public void spotrs(char uplo, int n, int nrhs, float[] A, int lda, float[] B, int ldb, ref int info) {
984            lapack_spotrs(ref uplo, ref n, ref nrhs, A, ref lda, B, ref ldb, ref info);
985        }
986
987        public void cpotrs(char uplo, int n, int nrhs, fcomplex[] A, int lda, fcomplex[] B, int ldb, ref int info) {
988            lapack_cpotrs(ref uplo, ref n, ref nrhs, A, ref lda, B, ref ldb, ref info);
989        }
990
991        public void zpotrs(char uplo, int n, int nrhs, complex[] A, int lda, complex[] B, int ldb, ref int info) {
992            lapack_zpotrs(ref uplo, ref n, ref nrhs, A, ref lda, B, ref ldb, ref info);
993        }
994
995
996       
997        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) {
998             double [] work = new  double [1];
999            int [] iwork = new int[1];
1000            int lwork = -1;
1001            /*HC:HycalpTag1*/
1002            lapack_dgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, iwork, ref info);
1003            if (info != 0)
1004                throw new ILArgumentException("dgelsd: invalid parameter: #" + (-info).ToString());
1005            lwork = ILAENV(9, "dgelsd", " ",0,0,0,0);
1006            if (lwork <= 0)
1007                throw new ILArgumentException("dgelsd: unknown error determining working size liwork");
1008            iwork = new int[lwork];
1009            lwork = (int)work[0];
1010            work = new  double [lwork];
1011            /*HC:HycalpTag2*/
1012            lapack_dgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, iwork, ref info);
1013        }
1014
1015#region HYCALPER AUTO GENERATED CODE
1016
1017       
1018        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) {
1019            float [] work = new  float [1];
1020            int [] iwork = new int[1];
1021            int lwork = -1;
1022            lapack_sgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, iwork, ref info);
1023            if (info != 0)
1024                throw new ILArgumentException("dgelsd: invalid parameter: #" + (-info).ToString());
1025            lwork = ILAENV(9, "dgelsd", " ",0,0,0,0);
1026            if (lwork <= 0)
1027                throw new ILArgumentException("dgelsd: unknown error determining working size liwork");
1028            iwork = new int[lwork];
1029            lwork = (int)work[0];
1030            work = new  float [lwork];
1031            lapack_sgelsd (ref m, ref n, ref nrhs, A, ref lda, B, ref ldb, S,ref RCond, ref rank, work, ref lwork, iwork, ref info);
1032        }
1033       
1034        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) {
1035            complex [] work = new  complex [1];
1036            int [] iwork = new int[1];
1037            int lwork = -1;
1038            double [] rwork = new double [1];  lapack_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);
1039            if (info != 0)
1040                throw new ILArgumentException("dgelsd: invalid parameter: #" + (-info).ToString());
1041            lwork = ILAENV(9, "dgelsd", " ",0,0,0,0);
1042            if (lwork <= 0)
1043                throw new ILArgumentException("dgelsd: unknown error determining working size liwork");
1044            iwork = new int[lwork];
1045            lwork = (int)work[0];
1046            work = new  complex [lwork];
1047            rwork = new double [(int)rwork[0]];  lapack_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);
1048        }
1049       
1050        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) {
1051            fcomplex [] work = new  fcomplex [1];
1052            int [] iwork = new int[1];
1053            int lwork = -1;
1054            float [] rwork = new float [1];  lapack_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);
1055            if (info != 0)
1056                throw new ILArgumentException("dgelsd: invalid parameter: #" + (-info).ToString());
1057            lwork = ILAENV(9, "dgelsd", " ",0,0,0,0);
1058            if (lwork <= 0)
1059                throw new ILArgumentException("dgelsd: unknown error determining working size liwork");
1060            iwork = new int[lwork];
1061            lwork = (int)work[0];
1062            work = new  fcomplex [lwork];
1063            rwork = new float [(int)rwork[0]];  lapack_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);
1064        }
1065
1066#endregion HYCALPER AUTO GENERATED CODE
1067
1068
1069       
1070        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) {
1071            int lwork = -1;
1072             double [] work = new  double [1];
1073             //
1074            /*!HC:lapack_?gelsy*/
1075            lapack_dgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork,ref info);
1076            if (info != 0)
1077                throw new ILArgumentException("?gelsy: unable to determine optimal block size. cancelling...");
1078            lwork = (int) work[0];
1079            work = new  double [lwork];
1080             //
1081            /*!HC:lapack_?gelsy*/
1082            lapack_dgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork,ref info);
1083        }
1084
1085#region HYCALPER AUTO GENERATED CODE
1086
1087       
1088        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) {
1089            int lwork = -1;
1090            float [] work = new  float [1];
1091           
1092            lapack_sgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork,ref info);
1093            if (info != 0)
1094                throw new ILArgumentException("?gelsy: unable to determine optimal block size. cancelling...");
1095            lwork = (int) work[0];
1096            work = new  float [lwork];
1097           
1098            lapack_sgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork,ref info);
1099        }
1100       
1101        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) {
1102            int lwork = -1;
1103            complex [] work = new  complex [1];
1104            double[] rwork = new double[1];
1105            lapack_zgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork, rwork, ref info);
1106            if (info != 0)
1107                throw new ILArgumentException("?gelsy: unable to determine optimal block size. cancelling...");
1108            lwork = (int) work[0];
1109            work = new  complex [lwork];
1110            rwork = new double[lwork];
1111            lapack_zgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork, rwork, ref info);
1112        }
1113       
1114        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) {
1115            int lwork = -1;
1116            fcomplex [] work = new  fcomplex [1];
1117            float[] rwork = new float[1];
1118            lapack_cgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork, rwork, ref info);
1119            if (info != 0)
1120                throw new ILArgumentException("?gelsy: unable to determine optimal block size. cancelling...");
1121            lwork = (int) work[0];
1122            work = new  fcomplex [lwork];
1123            rwork = new float[lwork];
1124            lapack_cgelsy (ref m,ref n,ref nrhs,A,ref lda,B,ref ldb,JPVT0,ref RCond,ref rank,work,ref lwork, rwork, ref info);
1125        }
1126
1127#endregion HYCALPER AUTO GENERATED CODE
1128
1129        #region ?GEEVX
1130        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) {
1131            double [] work = new double[1];
1132            int lwork = -1;
1133            int [] iwork = new int[2 * n - 2];
1134            lapack_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);
1135            if (info != 0)
1136                throw new ILArgumentException("error in lapack call: ?geevx. (" + info + ")");
1137            lwork = (int)work[0];
1138            work = new double[lwork];
1139            lapack_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);
1140        }
1141        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) {
1142            float [] work = new float[1];
1143            int lwork = -1;
1144            int [] iwork = new int[2 * n - 2];
1145            lapack_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);
1146            if (info != 0)
1147                throw new ILArgumentException("error in lapack call: ?geevx. (" + info + ")");
1148            lwork = (int)work[0];
1149            work = new float[lwork];
1150            lapack_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);
1151        }
1152        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) {
1153            fcomplex [] work = new fcomplex[1];
1154            int lwork = -1;
1155            float[] rwork = new float[2 * n];
1156            lapack_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);
1157            if (info != 0)
1158                throw new ILArgumentException("error in lapack call: ?geevx. (" + info + ")");
1159            lwork = (int)work[0];
1160            work = new fcomplex[lwork];
1161            lapack_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);
1162        }
1163        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) {
1164            complex [] work = new complex[1];
1165            int lwork = -1;
1166            double[] rwork = new double[2 * n];
1167            lapack_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);
1168            if (info != 0)
1169                throw new ILArgumentException("error in lapack call: ?geevx. (" + info + ")");
1170            lwork = (int)work[0];
1171            work = new complex[lwork];
1172            lapack_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);
1173        }
1174        #endregion
1175
1176        #region ?SYEVR
1177        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) {
1178            double [] work = new double[1];
1179            int lwork = -1, liwork = -1;
1180            int [] iwork = new int[1];
1181            lapack_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);
1182            if (info != 0) {
1183                throw new ILArgumentException("?syevr: error returned from lapack: " + info);
1184            }
1185            lwork = (int)work[0];
1186            liwork = (int) iwork[0];
1187            //work = ILMemoryPool.Pool.New<double>(lwork);
1188            //iwork = ILMemoryPool.Pool.New<int>(liwork);
1189            work = new double[lwork];
1190            iwork = new int[liwork];
1191            lapack_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);
1192            //ILMemoryPool.Pool.RegisterObject(work);
1193            //ILMemoryPool.Pool.RegisterObject(iwork);
1194            if (info != 0) {
1195                throw new ILArgumentException("?syevr: error returned from lapack: " + info);
1196            }
1197        }
1198        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) {
1199            float [] work = new float[1];
1200            int lwork = -1, liwork = -1;
1201            int [] iwork = new int[1];
1202            lapack_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);
1203            if (info != 0) {
1204                throw new ILArgumentException("?syevr: error returned from lapack: " + info);
1205            }
1206            lwork = (int)work[0];
1207            work = ILMemoryPool.Pool.New<float>(lwork);
1208            liwork = (int) iwork[0];
1209            iwork = ILMemoryPool.Pool.New<int>(liwork);
1210            lapack_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);
1211            ILMemoryPool.Pool.Free(work);
1212            ILMemoryPool.Pool.Free(iwork);
1213            if (info != 0) {
1214                throw new ILArgumentException("?syevr: error returned from lapack: " + info);
1215            }
1216        }
1217        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) {
1218            fcomplex[] work = new fcomplex[1];
1219            float [] rwork = new float[1];
1220            int [] iwork = new int[1];
1221            int lrwork = -1, liwork = -1, lwork = -1;
1222            lapack_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);
1223            if (info != 0) {
1224                throw new ILArgumentException("?chevr: error returned from lapack: " + info);
1225            }
1226            lrwork = (int)rwork[0];
1227            rwork = ILMemoryPool.Pool.New<float>(lrwork);
1228            lwork = (int) work[0];
1229            work = ILMemoryPool.Pool.New<fcomplex>(lwork);
1230            liwork = (int) iwork[0];
1231            iwork = ILMemoryPool.Pool.New<int>(liwork);
1232            lapack_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);
1233            ILMemoryPool.Pool.Free(rwork);
1234            ILMemoryPool.Pool.Free(work);
1235            ILMemoryPool.Pool.Free(iwork);
1236            if (info != 0) {
1237                throw new ILArgumentException("?syevr: error returned from lapack: " + info);
1238            }
1239        }
1240        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) {
1241            complex[] work = new complex[1];
1242            double [] rwork = new double[1];
1243            int [] iwork = new int[1];
1244            int lrwork = -1, liwork = -1, lwork = -1;
1245            lapack_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);
1246            if (info != 0) {
1247                throw new ILArgumentException("?heevr: error returned from lapack: " + info);
1248            }
1249            lrwork = (int)rwork[0];
1250            rwork = ILMemoryPool.Pool.New<double>(lrwork);
1251            lwork = (int) work[0];
1252            work = ILMemoryPool.Pool.New<complex>(lwork);
1253            liwork = (int) iwork[0];
1254            iwork = ILMemoryPool.Pool.New<int>(liwork);
1255            lapack_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);
1256            ILMemoryPool.Pool.Free(rwork);
1257            ILMemoryPool.Pool.Free(work);
1258            ILMemoryPool.Pool.Free(iwork);
1259            if (info != 0) {
1260                throw new ILArgumentException("?syevr: error returned from lapack: " + info);
1261            }
1262        }
1263        #endregion
1264
1265        #region ?[he/sy]gv - generalized eigenproblem
1266        public void dsygv (int itype, char jobz, char uplo, int n, double  [] A, int lda, double  [] B, int ldb, double [] w, ref int info) {
1267            // query workspace
1268            int lwork = -1;
1269            double [] work = new double[1] {0.0};
1270            lapack_dsygv (ref itype,ref jobz,ref uplo,ref n, A,ref lda, B,ref ldb, w, work, ref lwork, ref info);
1271            if (info != 0 || work[0] <= 0.0) return;
1272            // create temporary array(s)
1273            lwork = (int) work[0];
1274            work = ILMemoryPool.Pool.New<double>(lwork);
1275            lapack_dsygv (ref itype,ref jobz,ref uplo,ref n, A,ref lda, B,ref ldb, w, work, ref lwork, ref info);
1276            ILMemoryPool.Pool.Free(work);
1277        }       
1278        public void ssygv (int itype, char jobz, char uplo, int n, float   [] A, int lda, float   [] B, int ldb, float  [] w, ref int info) {
1279            // query workspace
1280            int lwork = -1;
1281            float [] work = new float[1] {0.0f};
1282            lapack_ssygv (ref itype,ref jobz,ref uplo,ref n, A,ref lda, B,ref ldb, w, work, ref lwork, ref info);
1283            if (info != 0 || work[0] <= 0.0) return;
1284            // create temporary array(s)
1285            lwork = (int) work[0];
1286            work = ILMemoryPool.Pool.New<float>(lwork);
1287            lapack_ssygv (ref itype,ref jobz,ref uplo,ref n, A,ref lda, B,ref ldb, w, work, ref lwork, ref info);
1288            ILMemoryPool.Pool.Free(work);
1289        }
1290        public void chegv (int itype, char jobz, char uplo, int n, fcomplex[] A, int lda, fcomplex[] B, int ldb, float  [] w, ref int info) {
1291            int lwork = (int)Math.Max(1,2*n-1); bool dummy;
1292            float [] rwork = ILMemoryPool.Pool.New<float>(Math.Max(1,3*n-2),false, out dummy);
1293            fcomplex [] work = ILMemoryPool.Pool.New<fcomplex>(lwork,false, out dummy);
1294            // NOTE: this implementation of LAPACK (netlib.org, not optimized) seems to overwrite B even if only a workspace query is assumed.
1295            // therefore this hack uses the (may not optimal efficiently) working size 2*n-1 for computation.
1296            lapack_chegv(ref itype,ref  jobz,ref  uplo,ref  n, A,ref  lda, B,ref  ldb, w, work, ref lwork, rwork, ref info);
1297            ILMemoryPool.Pool.Free(rwork);
1298            ILMemoryPool.Pool.Free(work);
1299        }
1300        public void zhegv (int itype, char jobz, char uplo, int n, complex [] A, int lda, complex [] B, int ldb, double [] w, ref int info) {
1301            // NOTE: this implementation of LAPACK (netlib.org, not optimized) seems to overwrite B even if only a workspace query is assumed.
1302            // therefore this hack uses the (may not optimal efficiently) working size 2*n-1 for computation.
1303            int lwork = (int)Math.Max(1,2*n-1); bool dummy;
1304            double [] rwork = ILMemoryPool.Pool.New<double>(Math.Max(1,3*n-2));
1305            complex [] work = ILMemoryPool.Pool.New<complex>(lwork,false, out dummy);
1306            lapack_zhegv(ref itype,ref  jobz,ref  uplo,ref  n, A,ref  lda, B,ref  ldb, w, work, ref lwork, rwork, ref info);
1307            ILMemoryPool.Pool.Free(rwork);
1308            ILMemoryPool.Pool.Free(work);
1309        }
1310        #endregion
1311
1312        #endregion
1313   }
1314}
Note: See TracBrowser for help on using the repository browser.