![]() |
![]() |
|||||||
Fortran to C++ ConversionObjexx Engineering offers a Fortran to C++ conversion service based on principles and tools originally developed to migrate our own applications. The goal of our conversion is to preserve the syntax and semantics of the Fortran within fully ANSI/ISO compliant C++ to preserve the value of the code and existing documentation and to allow a wide range of developers to maintain the code. Some of the technical aspects of our conversion include:
The Objexx Fortran Compatibility Library (ObjexxFCL) that provides the array, string, and intrinsic function support is included in C++ source form with licensing that allows modification by the client for use with future versions of their project.
|
||||||||
C============================================
C Multiply Matrix by Vector: b = A x
C============================================
SUBROUTINE MULTAX( M, N, A, X, B )
! Argument Declarations
INTEGER M, N
REAL A(M,N)
REAL X(N)
REAL B(M)
! Variable Declarations
INTEGER I, J
REAL BI
! Compute b = A x
DO I = 1, M
BI = 0.0
DO J = 1, N
BI = BI + A(I,J) * X(J)
END DO
B(I) = BI
END DO
END
|
C++ Conversion
#include "multAx.h"
#include "FArray.h"
//===========================================
// Multiply Matrix by Vector: b = A x
//===========================================
void
MULTAX(
int M,
int N,
FArray2D_f & A,
FArray1D_f & X,
FArray1D_f & B
)
{
// Compute b = A x
for ( int I = 1; I <= M; ++I ) {
float BI = 0.0;
for ( int J = 1; J <= N; ++J ) {
BI += A(I,J) * X(J);
}
B(I) = BI;
}
}
|