int main() { array double complex z[2][2] = {2, -4, 3, -7}; array complex z1[2][2] = {2, -4, 3, -7}; array double complex z2[2][2] = {2, -4, 3, complex(1,-7)}; array double complex z3[4] = {2, complex(-4,1),3}; double anorm; anorm = norm(z, "1"); printf("1-norm of a = %f\n", anorm); anorm = norm(z, "i"); printf("infinity-norm of a = %f\n", anorm); anorm = norm(z, "f"); printf("Frobenius-norm of a = %f\n", anorm); anorm = norm(z, "m"); printf("max(abs(a)) = %f\n\n", anorm); anorm = norm(z1, "1"); printf("1-norm of a = %f\n", anorm); anorm = norm(z1, "i"); printf("infinity-norm of a = %f\n", anorm); anorm = norm(z1, "f"); printf("Frobenius-norm of a = %f\n", anorm); anorm = norm(z1, "m"); printf("max(abs(a)) = %f\n\n", anorm); anorm = norm(z2, "1"); printf("1-norm of z2 = %f\n", anorm); anorm = norm(z2, "i"); printf("infinity-norm of z2 = %f\n", anorm); anorm = norm(z2, "f"); printf("Frobenius-norm of z2 = %f\n", anorm); anorm = norm(z2, "m"); printf("max(abs(z2)) = %f\n\n", anorm); anorm = norm(z3, "1"); printf("1-norm of d = %f\n", anorm); anorm = norm(z3, "2"); printf("2-norm of d = %f\n", anorm); anorm = norm(z3, "2.1"); printf("2.1-norm of d = %f\n", anorm); anorm = norm(z3, "i"); printf("infinity-norm of d = %f\n", anorm); anorm = norm(z3, "-i"); printf("negative infinity-norm of d = %f\n", anorm); }
1-norm of a = 11.000000 infinity-norm of a = 10.000000 Frobenius-norm of a = 8.831761 max(abs(a)) = 7.000000 1-norm of a = 11.000000 infinity-norm of a = 10.000000 Frobenius-norm of a = 8.831761 max(abs(a)) = 7.000000 1-norm of z2 = 11.071068 infinity-norm of z2 = 10.071068 Frobenius-norm of z2 = 8.888194 max(abs(z2)) = 7.071068 1-norm of d = 9.123106 2-norm of d = 5.477226 2.1-norm of d = 5.355310 infinity-norm of d = 4.123106 negative infinity-norm of d = 0.000000