# On solving sets of linear equations in Fortran vs Julia

**URL:** <https://discourse.julialang.org/t/on-solving-sets-of-linear-equations-in-fortran-vs-julia/33729>\
**Category:** Numerics\
**Tags:** fortran, mkl, python, lapack\
**Created:** [January 24, 2020, 7:04am UTC](https://discourse.julialang.org/t/on-solving-sets-of-linear-equations-in-fortran-vs-julia/33729 "2020-01-24T07:04:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mfh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mfh/32/13787_2.png) [@mfh](https://discourse.julialang.org/u/mfh)\
**Post date:** [January 24, 2020, 7:49am UTC](https://discourse.julialang.org/t/on-solving-sets-of-linear-equations-in-fortran-vs-julia/33729/2 "2020-01-24T07:49:58Z")

</div>

From what you describe it seems indeed that something wrong is happening on the FORTRAN side. However, to rule out that your making an error in the process of extracting data from FORTRAN to Julia I’d suggest to take a look at two options:

- Compile your FORTRAN code into a shared object and directly call it from Julia with `ccall` to get the system matrices, the right-hand side and the solution from FORTRAN and then you can check bit by bit from Julia.
- Perhaps a bit easier: Use an established file format. For MatrixMarket for example there is a [FORTRAN implementation](https://math.nist.gov/MatrixMarket/mmio/f/mmiof77.html) and a [Julia one](https://github.com/JuliaSparse/MatrixMarket.jl) and it’s also pretty simple to work with. Maybe that helps you to get some insight?

For using MKL to solve your problem, take a look at [MKL.jl](https://github.com/JuliaComputing/MKL.jl) … they do all the hard work of rerouting Julia’s default linear algebra operations to the MKL.

With respect to quantifying the quality of a solution, looking at the residual `Ax - b` as you describe is exactly what I would do.

---

_[View the full topic](https://discourse.julialang.org/t/on-solving-sets-of-linear-equations-in-fortran-vs-julia/33729)._
