4,640 questions
3
votes
1
answer
150
views
What produces the strange result of qr(A) when the number of the columns of A is greater than the rank of A?
I do not understand the behavior of Julia's qr function.
For the result of qr(A_1), the rank of A_1 is 2, so the result is as expected.
On the other hand, the result of qr(A_2) is puzzling. Since the ...
Best practices
0
votes
18
replies
313
views
Reducing significant digits and eliminating scientific notation when float/double approaches zero
Surely, a number of ways are at a developer's disposal to reduce a rounding error of 1.78814e-07 variable assignment to 0.000000. In linear algebra, a system of equations cannot be solved, unless ...
Advice
0
votes
7
replies
93
views
I found two solutions on how to generate points on a circle, within two radius values. One solutions favors the center, one does not. Why is this so?
There was a Reddit post about generating points randomly in a circle, where the points are constrained between two radius bounds, minRadius and maxRadius. The formula to generate a point from an ...
Advice
0
votes
0
replies
64
views
Please explain this vectorized Bellman's Equation
Can some please explain this vectorized Bellman equation to me in simple terms?
The Bellman equation usually has "summation symbol", "summation symbol", "summation symbol"...
1
vote
0
answers
108
views
What do modern libraries like numpy or scipy specifically do in order to achieve partial pivoting during matrix inversion?
As an exercise problem I am trying to write a program that will invert matrices using the method of LU decomposition with partial pivoting. I sort of understand LU decomposition but was struggling to ...
4
votes
1
answer
203
views
How do I get the 3D rotation from one orthogonal basis to another (quaternion or matrix)
I have right, up, and forward normalized vectors that are all orthogonal for two orientations. How would I get the rotation between these two orientations.
This code would be used to get the rotation ...
4
votes
3
answers
301
views
Triangulating matrices using LU decomposition method in C : Question about for loop optimization
Matrices can be triangulated using less than ten lines of code in C, I have heard being said. But LU decomposition method needs to be used, instead of Cramer's rule. So, I was trying to do that. My ...
Advice
0
votes
2
replies
87
views
Self-Supervised Learning R - Matrix Transformation
I've been reading the R library Semi-Supervised Classification (SSC) here
On page 7, there is a transformation applied to train/test matrices:
ktrain <- as.matrix(exp(- 0.048 * dtrain^2))
kitest &...
Advice
0
votes
0
replies
108
views
How to ergonomically perform matrix multiplication inside Polars streaming engine?
I have a large table of data, in the range of hundreds of millions of rows/events, each which has around 50 numerical columns, call them c1 through c50. For each event, say I want to perform matrix-...
3
votes
3
answers
210
views
Calls to Numpy routines from within multiprocessing tasks are very slow
I am calling numpy.linalg.inv from within a multiprocessing task forked from the Python multiprocessing module. I compare the Numpy routine to my own inverse routine my_inv.
What I see is that the ...
1
vote
1
answer
133
views
Iterative solvers with right-preconditioning: inconsistency between applying the preconditioner to the matrix, or to x
Summary
Using the Eigen library, I see significantly different numbers of BiCGStab iterations when I solve Ax = b with a right-preconditioner, i.e., [A M^(-1)] Mx = b, (a) by precomputing A M^(-1) ...
3
votes
0
answers
86
views
Returning mutable references and lifetime in rust [duplicate]
I am trying to develop a linear algebra library in rust. So, as part of it I am writing code that iterates through a n-dimensional array and returns mutable references. It's like writing a view for a ...
0
votes
1
answer
117
views
scipy.linalg.eig(L) gives imaginary parts that shouldn't be there
I am trying to compute the eigenvalues, left, and right eigenvectors of a Laplacian matrix in Python.
Here is my matrix:
lap = [[-2. 1. 0. 1.] [ 1. -2. 1. 0.] [ 0. 1. -2. 1.] [ 1. 0. 1. -2.]]
I ...
1
vote
1
answer
165
views
Why isn't my Hermitian covariance matrix invertible?
I am following a paper that uses a Hermitian covariance matrix
and inverts it to produce a Fisher matrix. I construct my covariance as Gamma[i,m,n], stored inside a larger array of shape (n_z, n_k, ...
1
vote
0
answers
121
views
Rewriting a n-dimensional matrix of dot products as a matrix multiplication
This is a crosspost from the Math Exchange forum, it seems to me that this question can be approached in two different ways so I am curious about different approaches.
https://math.stackexchange.com/...