public static void zgemvAX(out System.Numerics.Complex[] Y, System.Numerics.Complex[] A, int aRow, int aCol, TransposeType aTransposeType, System.Numerics.Complex[] X) { if (aCol != X.Length) { throw new ArgumentException("Mismatched size: aCol != X.Length(" + aCol + " != " + X.Length + ")"); } Y = new System.Numerics.Complex[X.Length]; byte trans = Trans.FromTransposeType(aTransposeType); int m = aRow; int n = aCol; System.Numerics.Complex alpha = 1.0; int lda = aRow; int incX = 1; System.Numerics.Complex beta = 0.0; int incY = 1; unsafe { fixed(System.Numerics.Complex *AP = &A[0]) fixed(System.Numerics.Complex * XP = &X[0]) fixed(System.Numerics.Complex * YP = &Y[0]) { IvyFEM.Lapack.ImportedFunctions.zgemv_(&trans, &m, &n, &alpha, AP, &lda, XP, &incX, &beta, YP, &incY); } } }
public static void dgemvAX(out double[] Y, double[] A, int aRow, int aCol, TransposeType aTransposeType, double[] X) { if (aCol != X.Length) { throw new ArgumentException("Mismatched size: aCol != X.Length(" + aCol + " != " + X.Length + ")"); } Y = new double[X.Length]; byte trans = Trans.FromTransposeType(aTransposeType); int m = aRow; int n = aCol; double alpha = 1.0; int lda = aRow; int incX = 1; double beta = 0.0; int incY = 1; unsafe { IvyFEM.Lapack.ImportedFunctions.dgemv_(&trans, &m, &n, &alpha, A, &lda, X, &incX, &beta, Y, &incY); } }
public static byte FromTransposeType(TransposeType transposeType) { switch (transposeType) { case TransposeType.Nop: return(Trans.Nop); case TransposeType.Transpose: return(Trans.Transpose); case TransposeType.ComplexTranspose: return(Trans.ComplexTranspose); } return(Trans.Nop); }
public static void zgbmvAX(out System.Numerics.Complex[] Y, System.Numerics.Complex[] AB, int aRow, int aCol, int subdia, int superdia, TransposeType aTransposeType, System.Numerics.Complex[] X) { if (aCol != X.Length) { throw new ArgumentException("Mismatched size: aCol != X.Length(" + aCol + " != " + X.Length + ")"); } Y = new System.Numerics.Complex[X.Length]; byte trans = Trans.FromTransposeType(aTransposeType); int m = aRow; int n = aCol; int kl = subdia; int ku = superdia; System.Numerics.Complex alpha = 1.0; //int lda = kl + ku + 1; // LDA must be at least (kl + ku + 1). int lda; int incX = 1; System.Numerics.Complex beta = 0.0; int incY = 1; // BlasのバンドマトリックスとLapackのバンドマトリックスは違う System.Numerics.Complex[] blasAB; ComplexBandMatrixLapack2Blas(out blasAB, out lda, AB, m, n, kl, ku); unsafe { fixed(System.Numerics.Complex *blasABP = &blasAB[0]) fixed(System.Numerics.Complex * XP = &X[0]) fixed(System.Numerics.Complex * YP = &Y[0]) { IvyFEM.Lapack.ImportedFunctions.zgbmv_( &trans, &m, &n, &kl, &ku, &alpha, blasABP, &lda, XP, &incX, &beta, YP, &incY); } } }
public static int zgemmAB(out System.Numerics.Complex[] C, out int cRow, out int cCol, System.Numerics.Complex[] A, int aRow, int aCol, TransposeType aTransposeType, System.Numerics.Complex[] B, int bRow, int bCol, TransposeType bTransposeType) { if (aCol != bRow) { throw new ArgumentException("Mismatched size: aCol != bRow(" + aCol + " != " + bRow + ")"); } cRow = aRow; cCol = bCol; C = new System.Numerics.Complex[cRow * cCol]; byte transa = Trans.FromTransposeType(aTransposeType); byte transb = Trans.FromTransposeType(bTransposeType); int m = aRow; int n = bCol; int k = aCol; System.Numerics.Complex alpha = 1.0; int lda = aRow; int ldb = bRow; System.Numerics.Complex beta = 0.0; int ldc = aRow; unsafe { fixed(System.Numerics.Complex *AP = &A[0]) fixed(System.Numerics.Complex * BP = &B[0]) fixed(System.Numerics.Complex * CP = &C[0]) { IvyFEM.Lapack.ImportedFunctions.zgemm_( &transa, &transb, &m, &n, &k, &alpha, AP, &lda, BP, &ldb, &beta, CP, &ldc); } } return(0); }
public static void dgemmAB(out double[] C, out int cRow, out int cCol, double[] A, int aRow, int aCol, TransposeType aTransposeType, double[] B, int bRow, int bCol, TransposeType bTransposeType) { if (aCol != bRow) { throw new ArgumentException("Mismatched size: aCol != bRow(" + aCol + " != " + bRow + ")"); } cRow = aRow; cCol = bCol; C = new double[cRow * cCol]; byte transa = Trans.FromTransposeType(aTransposeType); byte transb = Trans.FromTransposeType(bTransposeType); int m = aRow; int n = bCol; int k = aCol; double alpha = 1.0; int lda = aRow; int ldb = bRow; double beta = 0.0; int ldc = aRow; unsafe { IvyFEM.Lapack.ImportedFunctions.dgemm_( &transa, &transb, &m, &n, &k, &alpha, A, &lda, B, &ldb, &beta, C, &ldc); } }
public static void dgbmvAX(out double[] Y, double[] AB, int aRow, int aCol, int subdia, int superdia, TransposeType aTransposeType, double[] X) { if (aCol != X.Length) { throw new ArgumentException("Mismatched size: aCol != X.Length(" + aCol + " != " + X.Length + ")"); } Y = new double[X.Length]; byte trans = Trans.FromTransposeType(aTransposeType); int m = aRow; int n = aCol; int kl = subdia; int ku = superdia; double alpha = 1.0; //int lda = kl + ku + 1; // LDA must be at least (kl + ku + 1). int lda; int incX = 1; double beta = 0.0; int incY = 1; // BlasのバンドマトリックスとLapackのバンドマトリックスは違う double[] blasAB; DoubleBandMatrixLapack2Blas(out blasAB, out lda, AB, m, n, kl, ku); unsafe { IvyFEM.Lapack.ImportedFunctions.dgbmv_( &trans, &m, &n, &kl, &ku, &alpha, blasAB, &lda, X, &incX, &beta, Y, &incY); } }
public void Transpose(TransposeType type) { PianoLibrary.PianoKey.KeyTypes keyType; if(Enum.TryParse<PianoLibrary.PianoKey.KeyTypes>(Chord,out keyType)) { if (type == TransposeType.Up) { keyType = PianoKey.NextKey(keyType); } else { keyType = PianoKey.PrevKey(keyType); } } }