/*------------------------------------------------------------------------------* * File Name: OCN_f06.h * * Creation: TCZ 7/25/2001 * * Purpose: Origin C Header for NAG functions * * Copyright (c); OriginLab Corp. 2001 * * All Rights Reserved * * * * Modification Log: * *------------------------------------------------------------------------------*/ #ifndef _O_NAG_f06_H #define _O_NAG_f06_H //#importdll "ONAG" // NAG DLL prepared by OriginLab #pragma dll(ONAG) #include /* //////////////////////////////////////////////////////////////////////////////// This headfile contains the basic linear algebra functions in NAG_Chapter f06 which perform elementary algebraic operations involving vectors and matricces. The enumeration types given by typedef enum { NoTranspose, //Operate with the matrix Transpose, //Operate with the transpose of the matrix ConjugateTranspose //Operate with the conjugate transpose of the matrix } MatrixTranspose; typedef enum { UpperTriangle, //Upper triangle LowerTriangle // Lower triangle } MatrixTriangle; typedef enum { UnitTriangular, // Unit triangular, the diagonal elements are not referenced NotUnitTriangular // Non-unit triangular } MatrixUnitTriangular; typedef enum { LeftSide, // Multiply general matrix by symmetric, Hermitian or triangular matrix on the left RightSide // Multiply general matrix by symmetric, Hermitian or triangular matrix on the right } OperationSide; */ ///////////////////////////////////////////////////////////////////////////////// /** f06pac computes a matrix-vector product for general matrix. Example: This example computes the matrix-vector product for a general matrix 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 and a vector 17 18 19 20. void test_f06pac() //test for function dgemv(f06pac) { int nRows=4; int nCols=4; matrix mat_input={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}; vector vec_input={17,18,19,20}; vector vec_output(nRows); vec_output=0; dgemv(NoTranspose,nRows,nCols,1,mat_input,nCols,vec_input,1,1,vec_output,1); printf("Compute a matrix-vector product for general real matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1+2i,8+3i,2+3i,3+4i}, {2+1i,3+1i,5+2i,4+4i}, {1+3i,2+1i,2+3i,5+4i}, {1+4i,2+3i,6+1i,2+4i}}; vector vec_input={2+2i,1+1i,3+2i,2+4i}; vector vec_output(nRows); vec_output=0; zgemv(NoTranspose,nRows,nCols,1,mat_input,nCols,vec_input,1,1,vec_output,1); printf("Compute a matrix-vector product for general complex matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1,2,3,0}, {4,5,6,7}, {0,8,9,10}}; matrix mat_input_band={{0,1,2,3}, {4,5,6,7}, {8,9,10,0}}; int kupper=2; int klower=1; vector vec_input={11,12,13,14}; vector vec_output(nRows); vec_output=0; dgbmv(NoTranspose,nRows,nCols,klower,kupper,1,mat_input_band,nCols,vec_input,1,1,vec_output,1); printf("Compute a matrix-vector product for real band matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1+1.2i,2+2.1i,3+1.0i,0}, {4+2.6i,5+1.2i,6+2.6i,7+4.1i}, {0,8+1i,9,10+2i}}; int kupper=2; int klower=1; matrix mat_input_band={{0,1+1.2i,2+2.1i,3+1.0i}, {4+2.6i,5+1.2i,6+2.6i,7+4.1i}, {8+1i,9,10+2i,0}}; vector vec_input={11+2i,12,13+2i,14+1.8i}; vector vec_output(nRows); vec_output=0; zgbmv(NoTranspose,nRows,nCols,klower,kupper,1,mat_input_band,nCols,vec_input,1,1,vec_output,1); printf("Compute a matrix-vector product for complex band matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1,2,3,4}, {2,6,7,8}, {2,7,9,10}, {4,8,10,11}}; vector vec_input={12,13,14,15}; vector vec_output(nColRow); vec_output=0; dsymv(UpperTriangle,nColRow,1,mat_input,nColRow,vec_input,1,1,vec_output,1); printf("Compute a matrix-vector product for real symmetric matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1,2+2.1i,3+1.0i,4+1.3i}, {2-2.1i,5,6+2.6i,7+4.1i}, {3-1.0i,6-2.6i,9,10+2i}, {4-1.3i,7-4.1i,10-2i,11}}; vector vec_input={11+2i,12,13+2i,14+1.8i}; vector vec_output(nRowCol); vec_output=0; zhemv(UpperTriangle,nRowCol,1,mat_input,nRowCol,vec_input,1,1,vec_output,1); printf("Compute a matrix-vector product for complex Hermitian matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1,2,3,0}, {2,5,6,7}, {3,6,9,10}, {0,7,10,11}}; int k_nzero=2; matrix mat_input_band={{1,2,3}, {5,6,7}, {9,10,0}, {11,0,0}}; vector vec_input={11,12,13,14}; vector vec_output(nRowCol); vec_output=0; dsbmv(UpperTriangle,nRowCol,k_nzero,1,mat_input_band,k_nzero+1,vec_input,1,1,vec_output,1); printf("Compute a matrix-vector product for real symmetric band matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1,2+2.1i,0,0}, {2-2.1i,5,6+2.6i,0}, {0,6-2.6i,9,10+2i}, {0,0,10-2i,11}}; int k_nzero=1; matrix mat_input_band={{1,2+2.1i}, {5,6+2.6i}, {9,10+2i}, {11,0}}; vector vec_input={11+2i,12,13+2i,14+1.8i}; vector vec_output(nRowCol); vec_output=0; zhbmv(UpperTriangle,nRowCol,k_nzero,1,mat_input_band,k_nzero+1,vec_input,1,1,vec_output,1); printf("Compute a matrix-vector product for complex Hermitian band matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input_pack={1,2,3,4, 6,7,8, 9,10, 11}; matrix mat_input={{1,2,3,4}, {2,6,7,8}, {2,7,9,10}, {4,8,10,11}}; vector vec_input={12,13,14,15}; vector vec_output(nColRow); vec_output=0; dspmv(UpperTriangle,nColRow,1,mat_input_pack,vec_input,1,1,vec_output,1); printf("Compute a matrix-vector product for real symmetric packed matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1,2+2.1i,3+1.0i,4+1.3i}, {2-2.1i,5,6+2.6i,7+4.1i}, {3-1.0i,6-2.6i,9,10+2i}, {4-1.3i,7-4.1i,10-2i,11}}; matrix mat_input_pack={1,2+2.1i,3+1.0i,4+1.3i, 5,6+2.6i,7+4.1i, 9,10+2i, 11}; vector vec_input={11+2i,12,13+2i,14+1.8i}; vector vec_output(nRowCol); vec_output=0; zhpmv(UpperTriangle,nRowCol,1,mat_input_pack,vec_input,1,1,vec_output,1); printf("Compute a matrix-vector product for complex packed Hermitian matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1,2,3,4}, {0,6,7,8}, {0,0,9,10}, {0,0,0,11}}; vector vec_input={12,13,14,15}; vector vec_output; vec_output=vec_input; dtrmv(UpperTriangle,NoTranspose,NotUnitTriangular,nColRow, mat_input,nColRow,vec_output,1); printf("Compute a matrix-vector product for real triangular matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1+1.2i,2+2.1i,4+0.5i,1}, {0,5+1.2i,6+2.6i,2+1i}, {0,0,9,10+2i}, {0,0,0,11+4i}}; int k_nzero=1; vector vec_input={11+2i,12,13+2i,14+1.8i}; vector vec_output(nRowCol); vec_output=vec_input; ztrmv(UpperTriangle,NoTranspose,NotUnitTriangular,nRowCol, mat_input,nRowCol,vec_output,1); printf("Compute a matrix-vector product for complex Hermitian band matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1,2,3,0}, {0,5,6,7}, {0,0,9,10}, {0,0,0,11}}; int k_nzero=2; matrix mat_input_band={{1,2,3}, {5,6,7}, {9,10,0}, {11,0,0}}; vector vec_input={11,12,13,14}; vector vec_output(nRowCol); vec_output=vec_input; dtbmv(UpperTriangle,NoTranspose,NotUnitTriangular,nRowCol,k_nzero, mat_input_band,k_nzero+1,vec_output,1); printf("Compute a matrix-vector product for real tringular band matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1+1.2i,2+2.1i,0,0}, {0,5+1.2i,6+2.6i,0}, {0,0,9,10+2i}, {0,0,0,11+4i}}; int k_nzero=1; matrix mat_input_band={{1+1.2i,2+2.1i}, {5+1.2i,6+2.6i}, {9,10+2i}, {11+4i,0}}; vector vec_input={11+2i,12,13+2i,14+1.8i}; vector vec_output(nRowCol); vec_output=vec_input; ztbmv(UpperTriangle,NoTranspose,NotUnitTriangular,nRowCol,k_nzero, mat_input_band,k_nzero+1,vec_output,1); printf("Compute a matrix-vector product for complex triangular band matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input_pack={1,2,3,4, 6,7,8, 9,10, 11}; matrix mat_input={{1,2,3,4}, {0,6,7,8}, {0,0,9,10}, {0,0,0,11}}; vector vec_input={12,13,14,15}; vector vec_output(nColRow); vec_output=vec_input; dtpmv(UpperTriangle,NoTranspose,NotUnitTriangular,nColRow, mat_input_pack,vec_output,1); printf("Compute a matrix-vector product for real tringular packed matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input_pack={1+1.2i,2+2.1i,0,0, 5+1.2i,6+2.6i,0, 9,10+2i, 11+4i}; matrix mat_input={{1+1.2i,2+2.1i,0,0}, {0,5+1.2i,6+2.6i,0}, {0,0,9,10+2i}, {0,0,0,11+4i}}; vector vec_input={11+2i,12,13+2i,14+1.8i}; vector vec_output(nRowCol); vec_output=vec_input; ztpmv(UpperTriangle,NoTranspose,NotUnitTriangular,nRowCol, mat_input_pack,vec_output,1); printf("Compute a matrix-vector product for complex tringular packed matrix M*V:\n"); printf("M=\n"); //output mat_input for(int i=0;i mat_input={{1,2,3,4}, {0,6,7,8}, {0,0,9,10}, {0,0,0,11}}; vector vec_input={12,13,14,15}; vector vec_output; vec_output=vec_input; dtrsv(UpperTriangle,NoTranspose,NotUnitTriangular,nColRow, mat_input,nColRow,vec_output,1); printf("Solve a system of equations for real triangular matrix M*X=B:\n"); printf("M=\n"); //output mat_inputM for(int i=0;i mat_input={{1+1.2i,2+2.1i,4+0.5i,1}, {0,5+1.2i,6+2.6i,2+1i}, {0,0,9,10+2i}, {0,0,0,11+4i}}; vector vec_input={11+2i,12,13+2i,14+1.8i}; vector vec_output(nRowCol); vec_output=vec_input; ztrsv(UpperTriangle,NoTranspose,NotUnitTriangular,nRowCol, mat_input,nRowCol,vec_output,1); printf("Solve a system of equations for complex triangular matrix M*X=B:\n"); printf("M=\n"); //output mat_inputM for(int i=0;i mat_input={{1,2,0,0}, {0,1,2,0}, {0,0,1,2}, {0,0,0,1}}; int k_nzero=1; matrix mat_input_band={{1,2}, {1,2}, {1,2}, {1,0}}; vector vec_input={2,2,2,2}; vector vec_output(nRowCol); vec_output=vec_input; dtbsv(UpperTriangle,NoTranspose,NotUnitTriangular,nRowCol,k_nzero, mat_input_band,k_nzero+1,vec_output,1); printf("Solve a system of equations for real triangular band matrix M*X=B:\n"); printf("M=\n"); //output mat_inputM for(int i=0;i mat_input={{1+1.2i,2+2.1i,0,0}, {0,5+1.2i,6+2.6i,0}, {0,0,9,10+2i}, {0,0,0,11+4i}}; vector vec_input={11+2i,12,13+2i,14+1.8i}; int k_nonzero=1; matrix mat_input_band={{1+1.2i,2+2.1i}, {5+1.2i,6+2.6i}, {9,10+2i}, {11+4i,0}}; vector vec_output(nRowCol); vec_output=vec_input; ztbsv(UpperTriangle,NoTranspose,NotUnitTriangular,nRowCol,k_nonzero, mat_input_band,k_nonzero+1,vec_output,1); printf("Solve a system of equations for complex triangular band matrix M*X=B:\n"); printf("M=\n"); //output mat_inputM for(int i=0;i mat_input={{1,2,3,4}, {0,6,7,8}, {0,0,9,10}, {0,0,0,11}}; matrix mat_input_pack={1,2,3,4, 6,7,8, 9,10, 11}; vector vec_input={12,13,14,15}; vector vec_output; vec_output=vec_input; dtpsv(UpperTriangle,NoTranspose,NotUnitTriangular,nColRow, mat_input_pack,vec_output,1); printf("Solve a system of equations for real packed triangular matrix M*X=B:\n"); printf("M=\n"); //output mat_inputM for(int i=0;i mat_input={{1+1.2i,2+2.1i,4+0.5i,1}, {0,5+1.2i,6+2.6i,2+1i}, {0,0,9,10+2i}, {0,0,0,11+4i}}; matrix mat_input_pack={1+1.2i,2+2.1i,4+0.5i,1, 5+1.2i,6+2.6i,2+1i, 9,10+2i, 11+4i}; vector vec_input={11+2i,12,13+2i,14+1.8i}; vector vec_output(nRowCol); vec_output=vec_input; ztpsv(UpperTriangle,NoTranspose,NotUnitTriangular,nRowCol, mat_input_pack,vec_output,1); printf("Solve a system of equations for complex packed triangular matrix M*X=B:\n"); printf("M=\n"); //output mat_inputM for(int i=0;i mat_input={{1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16}}; vector vec_x={17,18,19,20}; vector vec_y={1,2,3,4}; matrix mat_output; mat_output=mat_input; int i,j; dger(nRows,nCols,1,vec_x,1,vec_y,1,mat_output,nRows); printf("Perform a rank-one update for real general matrix:A=A+X*transpose(Y)\n"); printf("A=\n"); //output mat_inputA for(i=0;i mat_input={{1+2i,8+3i,2+3i,3+4i}, {2+1i,3+1i,5+2i,4+4i}, {1+3i,2+1i,2+3i,5+4i}, {1+4i,2+3i,6+1i,2+4i}}; vector vec_x={2+2i,1+1i,3+2i,2+4i}; vector vec_y={1+2i,3+0.4i,1+0.2i,4+2.1i}; matrix mat_output(); mat_output=mat_input; int i,j; zgeru(nRows,nCols,1,vec_x,1,vec_y,1,mat_output,nRows); printf("Perform a rank-one update for complex general matrix:A=A+X*transpose(Y)\n"); printf("A=\n"); //output mat_inputA for(i=0;i mat_input={{1+2i,8+3i,2+3i,3+4i}, {2+1i,3+1i,5+2i,4+4i}, {1+3i,2+1i,2+3i,5+4i}, {1+4i,2+3i,6+1i,2+4i}}; vector vec_x={2+2i,1+1i,3+2i,2+4i}; vector vec_y={1+2i,3+0.4i,1+0.2i,4+2.1i}; matrix mat_output(); mat_output=mat_input; int i,j; zgerc(nRows,nCols,1,vec_x,1,vec_y,1,mat_output,nRows); printf("Perform a rank-one update for complex general matrix:A=A+X*transpose(Y)\n"); printf("A=\n"); //output mat_inputA for(i=0;i mat_input={{1,2,3,4}, {2,6,7,8}, {3,7,11,12}, {4,8,12,16}}; vector vec_x={1,1,1,1}; matrix mat_output; mat_output=mat_input; int i,j; dsyr(UpperTriangle,nColRows,1,vec_x,1,mat_output,nColRows); for(i=0;i mat_input={{1,8+3i,2+3i,3+4i}, {8-3i,3,5+2i,4+4i}, {8-3i,5-2i,2,5+4i}, {3-4i,4-4i,5-4i,2}}; vector vec_x={2+2i,1+1i,3+2i,2+4i}; matrix mat_output(); mat_output=mat_input; int i,j; zher(UpperTriangle,nColRows,1,vec_x,1,mat_output,nColRows); for(i=0;i mat_input_pack={1,2,3,4, 6,7,8, 9,10, 11}; matrix mat_input={{1,2,3,4}, {2,6,7,8}, {2,7,9,10}, {4,8,10,11}}; vector vec_input={12,13,14,15}; matrix mat_output_pack(mat_input_pack); matrix mat_output(nColRow,nColRow); dspr(UpperTriangle,nColRow,1,vec_input,1,mat_output_pack); int i,j; int k=0; for(i=0;i mat_input_pack={1,8+3i,2+3i,3+4i,3,5+2i,4+4i,2,5+4i,2}; matrix mat_input={{1,8+3i,2+3i,3+4i}, {8-3i,3,5+2i,4+4i}, {8-3i,5-2i,2,5+4i}, {3-4i,4-4i,5-4i,2}}; vector vec_x={2+2i,1+1i,3+2i,2+4i}; matrix mat_output_pack(mat_input_pack); int i,j; zhpr(UpperTriangle,nColRows,1,vec_x,1,mat_output_pack); int k=0; matrix mat_output(nColRows,nColRows); for(i=0;i mat_input={{1,2,3,4}, {2,6,7,8}, {3,7,11,12}, {4,8,12,16}}; vector vec_x={1,1,1,1}; vector vec_y={2,2,2,2}; matrix mat_output; mat_output=mat_input; int i,j; dsyr2(UpperTriangle,nColRows,1,vec_x,1,vec_y,1,mat_output,nColRows); for(i=0;i mat_input={{1,8+3i,2+3i,3+4i}, {8-3i,3,5+2i,4+4i}, {8-3i,5-2i,2,5+4i}, {3-4i,4-4i,5-4i,2}}; vector vec_x={2+2i,1+1i,3+2i,2+4i}; vector vec_y={1+1i,2+2i,3+1i,4+1i}; matrix mat_output(); mat_output=mat_input; int i,j; zher2(UpperTriangle,nColRows,1,vec_x,1,vec_y,1,mat_output,nColRows); for(i=0;i mat_input_pack={1,2,3,4, 6,7,8, 9,10, 11}; matrix mat_input={{1,2,3,4}, {2,6,7,8}, {2,7,9,10}, {4,8,10,11}}; vector vec_x={12,13,14,15}; vector vec_y={1,1,1,1}; matrix mat_output_pack(mat_input_pack); matrix mat_output(nColRow,nColRow); dspr2(UpperTriangle,nColRow,1,vec_x,1,vec_y,1,mat_output_pack); int i,j; int k=0; for(i=0;i mat_input_pack={1,8+3i,2+3i,3+4i,3,5+2i,4+4i,2,5+4i,2}; matrix mat_input={{1,8+3i,2+3i,3+4i}, {8-3i,3,5+2i,4+4i}, {8-3i,5-2i,2,5+4i}, {3-4i,4-4i,5-4i,2}}; vector vec_x={2+2i,1+1i,3+2i,2+4i}; vector vec_y={4+1i,2+1i,1+1i,1+1i}; matrix mat_output_pack(mat_input_pack); int i,j; zhpr2(UpperTriangle,nColRows,1,vec_x,1,vec_y,1,mat_output_pack); int k=0; matrix mat_output(nColRows,nColRows); for(i=0;i mat_a={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}; matrix mat_b={{1,1,1,1},{1,1,1,1},{1,1,1,1},{1,1,1,1}}; matrix mat_c(nRows_a,nCols_b); mat_c=0; dgemm(NoTranspose,NoTranspose,nRows_a,nCols_b,nColRows,1, mat_a,nColRows,mat_b,nCols_b,1,mat_c,nCols_b); printf("Compute a matrix-matrix product for general real matrix C=A*B:\n"); int i,j; printf("A=\n"); //output mat_a for(i=0;i mat_a={{1+2i,8+3i,2+3i,3+4i}, {2+1i,3+1i,5+2i,4+4i}, {1+3i,2+1i,2+3i,5+4i}, {1+4i,2+3i,6+1i,2+4i}}; matrix mat_b={{1+2i,1,1,1},{1,1,1,1},{1,1,1,1},{1,1,1,1}}; matrix mat_c(nRows_a,nColRows); mat_c=0; zgemm(NoTranspose,NoTranspose,nRows_a,nCols_b,nColRows,1, mat_a,nColRows,mat_b,nCols_b,1,mat_c,nCols_b); printf("Compute a matrix-matrix product for general complex matrix C=A*B:\n"); int i,j; printf("A=\n"); //output mat_a for(i=0;i mat_sy={{1,2,3,4},{2,6,7,8},{3,7,11,12},{4,8,12,16}}; matrix mat_g={{1,1,1,1},{1,1,1,1},{1,1,1,1},{1,1,1,1}}; matrix mat_c(nColRows_sy,nCols_b); mat_c=0; dsymm(LeftSide,UpperTriangle,nColRows_sy,nCols_b,1, mat_sy,nColRows_sy,mat_g,nCols_b,1,mat_c,nCols_b); printf("Compute a matrix-matrix product for a symmetric real matrix A and a general real matrix B, C=A*B:\n"); int i,j; printf("A=\n"); //output symmetric real matrix mat_sy for(i=0;i mat_h={{1,8+3i,2+3i,3+4i}, {8-3i,3,5+2i,4+4i}, {2-3i,5-2i,2,5+4i}, {3-4i,4-4i,5-4i,2}}; matrix mat_b={{1+2i,1,1,1},{1,1,1,1},{1,1,1,1},{1,1,1,1}}; matrix mat_c(nColRows_h,nCols_b); mat_c=0; zhemm(LeftSide,UpperTriangle,nColRows_h,nCols_b,1, mat_h,nColRows_h,mat_b,nCols_b,1,mat_c,nCols_b); printf("Compute a matrix-matrix product for a complex Hermitian matrix H and a general complex matrix B, C=H*B:\n"); int i,j; printf("H=\n"); //output complex Hermitian matrix mat_h for(i=0;i mat_tr={{1,2,3,4},{0,6,7,8},{0,0,11,12},{0,0,0,16}}; matrix mat_g={{1,1,1,1},{1,1,1,1},{1,1,1,1},{1,1,1,1}}; matrix mat_c(nColRows_tr,nCols_g); mat_c=mat_g; dtrmm(LeftSide,UpperTriangle,NoTranspose,NotUnitTriangular,nColRows_tr,nCols_g,1, mat_tr,nColRows_tr,mat_c,nCols_g); printf("Compute a matrix-matrix product for a triangular real matrix A and a general real matrix B, C=A*B:\n"); int i,j; printf("A=\n"); //output triangular real matrix mat_tr for(i=0;i mat_tr={{1,8+3i,2+3i,3+4i}, {0,3,5+2i,4+4i}, {0,0,2,5+4i}, {0,0,0,2}}; matrix mat_b={{1+2i,1,1,1},{1,1,1,1},{1,1,1,1},{1,1,1,1}}; matrix mat_c(nColRows_tr,nCols_b); mat_c=mat_b; ztrmm(LeftSide,UpperTriangle,NoTranspose,NotUnitTriangular,nColRows_tr,nCols_b,1, mat_tr,nColRows_tr,mat_c,nCols_b); printf("Compute a matrix-matrix product for a complex triangular matrix H and a general complex matrix B, C=T*B:\n"); int i,j; printf("T=\n"); //output complex triangular matrix mat_tr for(i=0;i mat_tr={{1,8+3i,2+3i,3+4i}, {0,3,5+2i,4+4i}, {0,0,2,5+4i}, {0,0,0,2}}; matrix mat_b={{1+2i,1,1,1},{1,2+3i,3+2i,4},{2-2i,3+5i,4,5},{3-1i,4+2i,5-3i,6+4i}}; matrix mat_c(nColRows_tr,nCols_b); mat_c=mat_b; ztrsm(LeftSide,UpperTriangle,NoTranspose,NotUnitTriangular,nColRows_tr,nCols_b,1, mat_tr,nColRows_tr,mat_c,nCols_b); printf("Solve a systrm of equations with multiple right-hand sides, T*X=B:\n"); int i,j; printf("T=\n"); //output complex triangular matrix mat_tr for(i=0;i mat_a={{1,2,3,4},{2,3,4,5},{3,7,11,12},{4,8,12,16}}; matrix mat_c(nRows,nRows); mat_c=0; dsyrk(UpperTriangle,NoTranspose,nRows,nCols,1, mat_a,nCols,1,mat_c,nRows); int i,j; for(i=0;i mat_a={{1,8+3i,2+3i,3+4i}, {8-3i,3,5+2i,4+4i}, {2-3i,5-2i,2,5+4i}, {3-4i,4-4i,5-4i,2}}; matrix mat_c(nRows,nRows); mat_c=0; zherk(UpperTriangle,NoTranspose,nRows,nCols,1, mat_a,nCols,1,mat_c,nRows); int i,j; for(i=0;i mat_a={{1,2,3,4},{2,2,8,4},{3,7,11,12},{4,8,12,16}}; matrix mat_b={{1,1,1,1},{1,1,1,1},{1,1,1,1},{1,1,1,1}}; matrix mat_c(nRows,nRows); mat_c=0; dsyr2k(UpperTriangle,NoTranspose,nRows,nCols,1, mat_a,nCols,mat_b,nCols,1,mat_c,nRows); int i,j; for(i=0;i mat_a={{1,8+3i,2+3i,3+4i}, {8-3i,3,5+2i,4+4i}, {2-3i,5-2i,2,5+4i}, {3-4i,4-4i,5-4i,2}}; matrix mat_b={{1+2i,1,1,1},{1,1-4i,1,1},{1,1+1i,1,1},{1-4i,1,1,1}}; matrix mat_c(nRows,nRows); mat_c=0; zher2k(UpperTriangle,NoTranspose,nRows,nCols,1, mat_a,nCols,mat_b,nCols,1,mat_c,nRows); printf("Perform a rank-2k update of a complex Hermitian matrix C=C+A*transpose(B)+B*transpose(A):\n"); int i,j; for(i=0;i mat_sy={{1,8+3i,2+3i,3+4i}, {8+3i,3,5+2i,4+4i}, {2+3i,5+2i,2,5+4i}, {3+4i,4+4i,5+4i,2}}; matrix mat_b={{1+2i,1,1,1},{1,1,1,1},{1,1,1,1},{1,1,1,1}}; matrix mat_c(nColRows_sy,nCols_b); mat_c=0; zsymm(LeftSide,UpperTriangle,nColRows_sy,nCols_b,1, mat_sy,nColRows_sy,mat_b,nCols_b,1,mat_c,nCols_b); printf("Compute a matrix-matrix product for a complex symmetric matrix A and a general complex matrix B, C=A*B:\n"); int i,j; printf("A=\n"); //output complex symmetric matrix mat_h for(i=0;i mat_a={{1,8+3i,2+3i,3+4i}, {8+3i,3,5+2i,4+4i}, {2+3i,5-2i,2,5+4i}, {3+4i,4-4i,5-4i,2}}; matrix mat_c(nRows,nRows); mat_c=0; zsyrk(UpperTriangle,NoTranspose,nRows,nCols,1, mat_a,nCols,1,mat_c,nRows); printf("Perform a rank-k update of a complex symmetric matrix C=A*conj(A)+C:\n"); int i,j; for(i=0;i mat_a={{1,8+3i,2+3i,3+4i}, {8-3i,3,5+2i,4+4i}, {2-3i,5-2i,2,5+4i}, {3-4i,4-4i,5-4i,2}}; matrix mat_b={{1+2i,1,1,1},{1,1-4i,1,1},{1,1+1i,1,1},{1-4i,1,1,1}}; matrix mat_c(nRows,nRows); mat_c=0; zsyr2k(UpperTriangle,NoTranspose,nRows,nCols,1, mat_a,nCols,mat_b,nCols,1,mat_c,nRows); printf("Perform a rank-2k update of a complex sysmmetric matrix C=C+A*transpose(B)+B*transpose(A):\n"); int i,j; for(i=0;i