question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Singular Matrix Error

See original GitHub issue

I’m trying to carry out one dimensional kriging using the python module ‘pykrige’ but I’m getting a few errors.

I tried to pass a zero vector as argument for the second variable.

My code is as below

        hs = np.array(np.arange(0,1,bw))
        hs0 = np.zeros(len(hs))

        OK = OrdinaryKriging(P[:, 0], P[:, 1], P[:, 2], variogram_model='linear',
                 verbose=False, enable_plotting=False)
        
        z, ss = OK.execute('grid', hs, hs0)

It gives me a linear algebra error when I run the execute command.

  File "/home/home_shihab/miniconda3/lib/python3.6/site-packages/pykrige/ok.py", line 396, in _exec_vector
    a_inv = scipy.linalg.inv(a)

  File "/home/home_shihab/miniconda3/lib/python3.6/site-packages/scipy/linalg/basic.py", line 976, in inv
    raise LinAlgError("singular matrix")

LinAlgError: singular matrix

Can anyone please help me with this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MuellerSebcommented, Aug 19, 2020

This should be fixed with v1.5.1 that will be released tomorrow. Closing for now. Feel free to re-open, if you have further questions.

1reaction
MuellerSebcommented, Jan 27, 2020

We could implement the pseudo-inverse for the case where we have a singular matrix, that can occur frequently when the number of points is to low, or the variogram-model is ill-choosen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Causes of a Singular Matrix Error on the TI-83 Plus and TI-84 ...
The message "ERROR:SINGULAR MATRIX" may be the result of one of two possible things. The first reason is an attempt to take the...
Read more >
Error: Singular Matrix - python - Stack Overflow
A singular matrix is a matrix that cannot be inverted, or, equivalently, that has determinant zero. For this reason, you cannot solve a ......
Read more >
Error: Singular Matrix - Knowledge Base - COMSOL
Your problem (equation system combined with the boundary conditions) is over- or underspecified. Check the equations and boundary conditions. You will often see ......
Read more >
How to Fix: numpy.linalg.LinAlgError: Singular matrix - Statology
This error occurs when you attempt to invert a singular matrix, which by definition is a matrix that has a determinant of zero...
Read more >
Understanding LinAlgError Singular Matrix - Python Pool
It means that the error occurred because of some linear algebra operation that is computationally incorrect. Talking more descriptively, we can ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found