# [ncl-talk] Need a solution for calculate Determinant of a (rather) large matrix

Lam Hoang lamhpvn at gmail.com
Tue Jul 10 06:34:54 MDT 2018

```Dear all,
I want to calculate determinant of a 41x41 real (float) matrix. I used
determinant() function
https://www.ncl.ucar.edu/Document/Functions/Built-in/determinant.shtml

However it is very slow.

I try to run the sample in the above page, it's quick. Even if I replace
integer values by float values (i.e replace 1 by 1.0, 0 by 0.0 and so on)
I try to create a 4x4 real matrix, give all members a value of 1.0
It seems that the determinant() function runs forever and does not return
any value

In the following illustration, a is sample matrix after replacing integer
by float values. It takes NCL few seconds to return the value d = 30

x is new 4x4 matrix created by my new() function, it never gives me any
result.

*Variable: a*

*Type: float*

*Total Size: 64 bytes*

*            16 values*

*Number of Dimensions: 2*

*Dimensions and sizes: [4] x [4]*

*Coordinates: *

*(0) d = 30*

*Variable: x*

*Type: float*

*Total Size: 64 bytes*

*            16 values*

*Number of Dimensions: 2*

*Dimensions and sizes: [4] x [4]*

*Coordinates: *

Any suggestion or solution for this?

Regards,

p/s: I am using NCL v6.3.0

--
Lam Hoang, PhD
Chief of Climate Prediction Division,
Viet Nam National Center of Hydro-Meteorology Forecasting
National Hydro-Meteorological Services of Vietnam
8 Phao Dai Lang street, Lang Thuong, Dong Da, Ha Noi, Vietnam
Mob: +84 9 682 34 682

Associate Researcher,
School of Earth, Atmosphere and Environment
Monash University, VIC 3800
Email: lam.hoang at monash.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180710/0a353b3e/attachment.html>
```