Blog 07-22-25: Fortran

Currently listening to:

Mascara ยท Innervisions

Blog Post

I have been trying to do more Quantum Computing. I have always felt like I can do more than the simple paper I wrote in college about data processing in quantum computing. It wasn't as relevant as I'd like it to be. I don't know.

What I mean by that I guess is I just want to show I can do more. Qiskit is the answer I hear many times. It seems for more industrial use which makes sense. At least when I learned it that's all I thought. I really want to just run through the basics of Quantum Computing again.

So, I picked up a copy of Numerical Recipes in Quantum Information Theory and Quantum Computing: An Adventure in FORTRAN 90. There was just one problem: I don't know Fortran 90.

That's fine though. Fortran is pretty much close enough to C if you change like everything. But they're both immortal languages so, at least they should run in similar environments. I got to work translating some snippets:

subroutine KPMR(m,n,A,p,q,B,C)
implicit none
integer::m,n,p,q,i,j,k,l
real*8,dimension(0:m-1,0:n-1)::A
real*8,dimension(0:p-1,0:q-1)::B
real*8,dimension(0:m*p-1,0:n*q-1)::C
do k=0,m-1,1
    do l=0,p-1,1
        do i=0,n-1,1
            do j=0,q-1,1
                C(p*k+l,q*i+j)=A(k,i)*B(l,j)
            end do
        end do
    end do
end do
end subroutine
#include <stdio.h>

void KPMR(int m, int n, double A[m][n], int p, int q, double B[p][q], double C[m*p][n*q]) {
    int i, j, k, l;
    for (k = 0; k < m; k++) {
        for (l = 0; l < p; l++) {
            for (i = 0; i < n; i++) {
                for (j = 0; j < q; j++) {
                    C[p*k+l][q*i+j] = A[k][i] * B[l][j];
                }
            }
        }
    }
}

This one is for calculating the tensor product of 2 matricies

WIP