Questions tagged [linear-algebra]
Linear Algebra is a core body of mathematics studying vector spaces and linear mappings between these spaces. Key topics include: matrices, vectors, simultaneous systems of linear equations, diagonal form, eigenvalues, eigenvectors, projections, points, lines, planes, hyperplanes, rotations and reflections.
linear-algebra
4,601
questions
0
votes
1
answer
23
views
Find in a 1000x20 matrix which columns are squares of linear combinations of other columns using Python (Numpy, Pandas)
I have a matrix of a shape (1000, 20) in csv file. Using this matrix, I need to answer the following questions:
Which columns are squares of linear combinations of other columns?
Which columns are ...
1
vote
1
answer
60
views
Why does using `extern` allow for runtime linking?
I have this code snippet:
extern crate blas;
extern crate openblas_src;
pub fn eigen_decompose_symmetric_tri_diagonal(
main_diag: &Vec<f64>,
sub_diag: &Vec<...
1
vote
0
answers
69
views
C++ Eigen svd.singularValues() returns only the nonzero ones. How do I get the zero ones as well?
I'm trying to compute the nullspace of a matrix (in this case, a matrix with one row, i.e. a vector).
To do so I compute its SVD using the Eigen::JacobiSvd class (Edit: passing ComputeFullV as a ...
0
votes
0
answers
10
views
Transform xy in a 2d plane to increase distance
I have N points in a 2d plane bounded region (0,1).
I want to transform them such that distance between two points is increased proportional to how close they are to center horizontal line, (similar ...
1
vote
1
answer
78
views
Matrix multiplication on Python to find a polynomial
I wish to find a method to multiply matrices (with other matrices and vectors) whose elements contain polynomial expressions and to obtain the final results in polynomial format.
I have a 10 by 10 ...
1
vote
0
answers
27
views
Is there a way to find the unitary diagonalization of a sparse normal matrix in SciPy?
A normal matrix A can be diagonalized as A = U D UH where U is unitary and D is diagonal. Is there a way to actually find this diagonalization in SciPy?
I've tried using eigsh/eigs, but that doesn't ...
0
votes
0
answers
12
views
Creating a pseudorandom matrix with a specific determinant and specific entropy
I was sampling several markov matrices for a project, for that:
I want to create a random matrix, which
is markovian(simply it's rows sum to one) and all its elements are between 0 and 1
it has a ...
0
votes
0
answers
27
views
Implementation of the lanczos algorithm to cross reference
I am trying to implement my own version of the lanczos algorithm. I would like to verify the output I am getting by checking against an easy to run and trustworthy implementation.
All I can find ...
0
votes
0
answers
5
views
Algorithm that finds roots of nilpotent matrices (when they exist)?
I'm curious about automatically calculating roots
B=ⁿ⎷A, where n is an integer larger than 1, and A is a square nilpotent matrix. I.e. find at least one square matrix B such that Bⁿ=A, or report that ...
2
votes
0
answers
53
views
Properly rasterize a triangles edges using barycentric algorithm
In an attempt to add a z-buffer to a custom 3D rendering engine, I need to use a barycentric algorithm to interpolate the depth of each point inside a triangle. While this approach works, the ...
0
votes
0
answers
47
views
How to setup rust LAPACK wrappers?
This has been asked before with no good answer.
As an MVE one can try this:
use lapack::*;
fn main() {
let n = 3;
let mut a = vec![3.0, 1.0, 1.0, 1.0, 3.0, 1.0, 1.0, 1.0, 3.0];
let mut w =...
2
votes
1
answer
72
views
Optimize this Python code that involves matrix inversion
I have this line of code that involves a matrix inversion:
X = A @ B @ np.linalg.pinv(S)
A is an n by n matrix, B is an n by m matrix, and S is an m by m matrix. m is smaller than n but usually not ...
5
votes
1
answer
90
views
LU decomposition on a sparse rectangular matrix in R
MATLAB is able to perform LU decomposition on a sparse rectangular matrix using [L, U, P, Q] = lu(A) but there is no R package to do so yet.
Trying to use Matrix::lu() on a sparse matrix in R returns ...
1
vote
2
answers
82
views
Rotating a vector field in an efficient way in python
I need to rotate a 3D vector field by 90 degrees. I do that by first using the NumPy function rot90 (see the docs here). Then I rotate each component at each position in a very inefficient way: using ...
1
vote
1
answer
67
views
how do I find the dimension of the span of the intersection/union of two null spaces of different sizes of matrices using numpy/scipy?
I need to find $dim(span(H\cap G))$ and $dim(span(H\cup G))$ where H and G are defined the following way:
I have no idea how to find the intersection/union of their null spaces and after that, I don'...