FORTRAN p-norm


 
Thread Tools Search this Thread
Top Forums Programming FORTRAN p-norm
# 1  
Old 05-26-2015
FORTRAN p-norm

What would be an accurate and efficient computation of the p-norm in Fortran?

Code:
Integer :: p
Real :: sum, pn
Do i = 1, Size (a)          
  sum = sum + ((Abs a(i)) ** p)       
End Do
pn = sum ** (1.0/ Real(p))

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

FORTRAN Extends

I am writing some code in fortran that defines certain shapes. Currently I have a cuboid and a prism. Now a parallelepiped is both a cuboid and a prism. Is there a way to code this? Currently I only have Type, Extends (Cuboid) :: Parallelepipied How can I do so that Parallelepipied is... (3 Replies)
Discussion started by: kristinu
3 Replies

2. Shell Programming and Scripting

FORTRAN Compiler

Need assistance in Fortran Compiler I need to install Fortran compiler on Linux distribution . I don't have root access to use rpm or yum to install compiler . Is there any way I can get it ? Are there any sites that has fortran compiler . Any links to download and install . (10 Replies)
Discussion started by: ajayram_arya
10 Replies

3. Shell Programming and Scripting

FORTRAN read statement

Hi, I've been having trouble figuring out what the following read statement is doing. DO I = 1, natom k = 3 * (i - 1) + 1 READ(8,*) AtNum(I), (X_2(J),J=k,k+2) END DO The part I don't understand is: (X_2(J),J=k,k+2) the file it is reading is simply a set of... (8 Replies)
Discussion started by: butson
8 Replies

4. Linux

Fortran compile problem

Hello everyone, I am trying to compile a code under fedora14.Kernel Linux 2.6.35.6-45fc14.i686-GNOME 2.32.0. I use f77,g77 and gfortran to compile but I get the same error all ways. Unsupported OPEN control item at (^) -- ACTION=, ASSOCIATEVARIABLE=, BLOCKSIZE=, BUFFERCOUNT=,... (1 Reply)
Discussion started by: miriammiriam
1 Replies

5. Linux

fortran compilation issue

Hi, I am getting following error when i try to compile : Error: Expected variable in READ statement at (1) read(12,*) ((l1to2(l,j),j=1,2),l=1,ngl(2,4)) Also i am getting following error : Error: Syntax error in COMMON statement at (1) at some statements. I am using mpif90... (1 Reply)
Discussion started by: aksharb
1 Replies

6. Red Hat

Bad flash sound in Firefox, Chrome (youtube norm)

There is a solution but it seems that it works only once - the first run (adding to a shortcut LD_PRELOAD=$HOME/linusmemcpy.so /usr/bin/firefox &) . Then an error occurs: Failed to execute child process "LD_PRELOAD=$HOME/linusmemcpy.so" (No such file or directory) linusmemcpy.so exists in the... (0 Replies)
Discussion started by: Xcislav
0 Replies

7. Programming

Fortran 77 and gfortran

Hi! I have a program in fortran77. This program was compiled with pgf90, but now, I need compiled it with gfortran. I show a bit of code. program hello PARAMETER(a=100) integer a write(*,*)'value ', a end program hello What's the problem? Thanks (2 Replies)
Discussion started by: kekaes
2 Replies

8. Programming

learning fortran

Can anyone recommend a very good Fortran online course for unix. It should also cover Fortran X11 programming if possible. I understand this learning cannot be rushed but a course that addresses useful topics sooner is best. If it isn't free, that's okay. (1 Reply)
Discussion started by: gav2251
1 Replies

9. UNIX for Dummies Questions & Answers

FORTRAN compiling

Hello, I have a FORTRAN code that I want to compile using F90 compiler. However, when I enter the command: f90 ./code.f -o ./code.out It would give me prompt saying that absoft license has failed, or something. I remember, however, that I could enter some keyword that ends with 'soft' in... (1 Reply)
Discussion started by: Iamthe great
1 Replies

10. Linux

Fortran 90 compiler

Hi everybody: Could anybody help me where could I download Fortran 90 complier? Thanks in advance. :) (2 Replies)
Discussion started by: tonet
2 Replies
Login or Register to Ask a Question
clanht.f(3)							      LAPACK							       clanht.f(3)

NAME
clanht.f - SYNOPSIS
Functions/Subroutines REAL function clanht (NORM, N, D, E) CLANHT returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex Hermitian tridiagonal matrix. Function/Subroutine Documentation REAL function clanht (characterNORM, integerN, real, dimension( * )D, complex, dimension( * )E) CLANHT returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex Hermitian tridiagonal matrix. Purpose: CLANHT returns the value of the one norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex Hermitian tridiagonal matrix A. Returns: CLANHT CLANHT = ( max(abs(A(i,j))), NORM = 'M' or 'm' ( ( norm1(A), NORM = '1', 'O' or 'o' ( ( normI(A), NORM = 'I' or 'i' ( ( normF(A), NORM = 'F', 'f', 'E' or 'e' where norm1 denotes the one norm of a matrix (maximum column sum), normI denotes the infinity norm of a matrix (maximum row sum) and normF denotes the Frobenius norm of a matrix (square root of sum of squares). Note that max(abs(A(i,j))) is not a consistent matrix norm. Parameters: NORM NORM is CHARACTER*1 Specifies the value to be returned in CLANHT as described above. N N is INTEGER The order of the matrix A. N >= 0. When N = 0, CLANHT is set to zero. D D is REAL array, dimension (N) The diagonal elements of A. E E is COMPLEX array, dimension (N-1) The (n-1) sub-diagonal or super-diagonal elements of A. Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: September 2012 Definition at line 102 of file clanht.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.2 Tue Sep 25 2012 clanht.f(3)