How to run C program and use its results in SageMath automatically?

asked 2022-02-03 17:29:54 +0100

lijr07 gravatar image

I have a program in SageMath in which I need to use some results obtained from a C program. Let me explain it in more detail.

In Sage, I define file1 to be some file. Then I use the following

tt3=computePairsOfElementsInSymmetricGroupToBeRunOnCProgramOfGreg(tt2,T1,typ,rank,W,file1)

to write results in file1.

Then I run a C program to get ./a.out file. Then I run the ./a.out file (it uses results in file1 computed above) and save the result to another file file2.

Then I run the following to get the final result.

c2=computeChT(file2)

Is there some way to compute c2 automatically in SageMath? That is, do not need to run ./a.out separately. Instead, to run ./a.out by using some command in Sage automatically.

I am asking this is because I have a lot of data and I need to run ./a.out manually each time. The file ./a.out is the same each time, but it uses different file1 and gives different values in file2 each time.

Thank you very much.

edit retag flag offensive close merge delete

Comments

@max, thanks a lot!

lijr07 gravatar imagelijr07 ( 2022-02-04 10:25:40 +0100 )edit