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 is a core body of mathematics studying vector spaces and linear mappings between these spaces. It has extensive applications in computer graphics, economics, engineering, and control systems, among other fields.

Key topics include: matrices, vectors, simultaneous systems of linear equations, diagonal form, eigenvalues, eigenvectors, projections, points, lines, planes, hyperplanes, rotations, reflections, shears, scaling.

Popular packages for solving linear algebra problems include , , , and .

4466 questions
22
votes
2 answers

How to change elements in sparse matrix in Python's SciPy?

I have built a small code that I want to use for solving eigenvalue problems involving large sparse matrices. It's working fine, all I want to do now is to set some elements in the sparse matrix to zero, i.e. the ones in the very top row (which…
seb
  • 2,251
  • 9
  • 30
  • 44
22
votes
1 answer

Fast sparse matrix multiplication

for class I have to write my own linear equation solver for sparse matrices. I am free to use any type of data structure for sparse matrices and I have to implement several solves, including conjuguate gradient. I was wondering if there is a famous…
lezebulon
  • 7,607
  • 11
  • 42
  • 73
22
votes
4 answers

Laderman's 3x3 matrix multiplication with only 23 multiplications, is it worth it?

Take the product of two 3x3 matrices A*B=C. Naively this requires 27 multiplications using the standard algorithm. If one were clever, you could do this using only 23 multiplications, a result found in 1973 by Laderman. The technique involves saving…
Hooked
  • 84,485
  • 43
  • 192
  • 261
22
votes
6 answers

Is there a way to calculate the CGAffineTransform needed to transform a view from frame A to frame B?

Say, I have two CGRects, CGRect A and CGRect B. My UIView's frame is the same as CGRect B, but I want to create an animation showing the UIView transitioning from frame A to B. I'm trying to do this by changing the transform property of the UIView,…
SpacyRicochet
  • 2,269
  • 2
  • 24
  • 39
21
votes
5 answers

numpy arbitrary precision linear algebra

I have a numpy 2d array [medium/large sized - say 500x500]. I want to find the eigenvalues of the element-wise exponent of it. The problem is that some of the values are quite negative (-800,-1000, etc), and their exponents underflow (meaning they…
jarondl
  • 1,593
  • 4
  • 18
  • 27
21
votes
8 answers

Looking for an elegant and efficient C++ matrix library

Greetings, googling for that subject brings, e.g., MTL, exmat, LAPACK and also here. I also seem to remember that Microsoft Research released one, but can't put my hands on it. I look for advice from someone who actually used (or developed...) one…
robi-y
  • 1,687
  • 16
  • 25
21
votes
5 answers

calculating the point of intersection of two lines

I have dynamically generated lines that animate and I want to detect when a lines hits another. I'm trying to implement some basic linear algebra to obtain the equation of the lines and then solving for x,y, but the results are erratic. At this…
Adam
  • 8,849
  • 16
  • 67
  • 131
20
votes
4 answers

DotNumerics, AlgLib, dnAnalytics, Math.net, F# for Numerics, Mtxvec?

I’ve been searching Google and Stack Overflow like crazy for days and have yet to find any recent, completely relevant information to answer the following question: What are the best C#/F#/.NET math libraries (specifically, those that wrap or…
Abe
  • 156
  • 5
  • 17
19
votes
1 answer

why does numpy matrix multiply computation time increase by an order of magnitude at 100x100?

When computing A @ a where A is a random N by N matrix and a is a vector with N random elements using numpy the computation time jumps by an order of magnitude at N=100. Is there any particular reason for this? As a comparison the same operation…
Linus
  • 400
  • 2
  • 9
19
votes
3 answers

MATLAB Optimisation of Weighted Gram-Schmidt Orthogonalisation

I have a function in MATLAB which performs the Gram-Schmidt Orthogonalisation with a very important weighting applied to the inner-products (I don't think MATLAB's built in function supports this). This function works well as far as I can tell,…
19
votes
1 answer

Numpy: convert an array to a triangular matrix

I was looking for a built in method to convert an linear array to triangular matrix. As I failed in find one I am asking for help in implementing one. Imagine an array like: In [203]: dm Out[203]: array([ 0.80487805, 0.90243902, 0.85365854, ..., …
tbrittoborges
  • 965
  • 1
  • 6
  • 16
19
votes
4 answers

Appropriate multiplication of matrices for rotation/translation

In order to rotate/translate object (rotation only about z-axis and translation only in xy plane) not just w.r.t to global center (device center) but also w.r.t other arbitrary points, I created an algorithm, which is correct (because all senior…
Patt Mehta
  • 4,110
  • 1
  • 23
  • 47
19
votes
5 answers

Large Matrix Inversion

I am looking at taking the inverse of a large matrix, common size of 1000 x 1000, but sometimes exceeds 100000 x 100000 (which is currently failing due to time and memory). I know that the normal sentiment is 'don't take the inverse, find some other…
19
votes
9 answers

How is linear algebra used in algorithms?

Several of my peers have mentioned that "linear algebra" is very important when studying algorithms. I've studied a variety of algorithms and taken a few linear algebra courses and I don't see the connection. So how is linear algebra used in…
MrDatabase
  • 43,245
  • 41
  • 111
  • 153
18
votes
3 answers

Left Matrix Division and Numpy Solve

I am trying to convert code that contains the \ operator from Matlab (Octave) to Python. Sample code B = [2;4] b = [4;4] B \ b This works and produces 1.2 as an answer. Using this web page http://mathesaurus.sourceforge.net/matlab-numpy.html I…
BBSysDyn
  • 4,389
  • 8
  • 48
  • 63