Calculate lsqr of two arrays on GPU
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Mantas Vaitonis
 el 19 de Jul. de 2018
  
    
    
    
    
    Respondida: Joss Knight
    
 el 21 de Jul. de 2018
            Hello,
Is there way to calculate lsqr of two arrays, I mean for each columns of arrays respectively. If a (NxM) and b(NxM) are gpuArrays then:
c=lsqr(a(:,1),b(:,1));
This works with no problem. Is there a way to do it on whole arrays? I know that it could be done with for loops, but it becomes bottleneck in my code.
0 comentarios
Respuesta aceptada
  Joss Knight
    
 el 21 de Jul. de 2018
        The least squares solution to a system of linear equations of one variable is pretty simple to work out, so you shouldn't really need any fancy linear algebra. I haven't actually checked this in MATLAB, but by my reckoning all you need is
c = sum(a .* b) ./ sum(a .* a);
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Linear Algebra en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

