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