lapack

Performing many small matrix operations in parallel in OpenCL

旧城冷巷雨未停 提交于 2020-01-04 06:52:55
问题 I have a problem that requires me to do eigendecomposition and matrix multiplication of many (~4k) small (~3x3) square Hermitian matrices. In particular, I need each work item to perform eigendecomposition of one such matrix, and then perform two matrix multiplications. Thus, the work that each thread has to do is rather minimal, and the full job should be highly parallelizable. Unfortunately, it seems all the available OpenCL LAPACKs are for delegating operations on large matrices to the GPU

Error using DGESV in Matlab mex

Deadly 提交于 2019-12-25 08:02:40
问题 I'm trying to solve a linear system with DGESV in a mex file. When I have a 2x2 system, the mex file works fine and no errors occurred, but when the system is larger than 2, MATLAB System Error dialog box apperas and says that matlab has encountered an internal problem and needs to be closed. Im using matlab r2016a on 64-bit windows 10 and intel composer XE 2013 The compile line is: mex -lmwlapack *.F The code is as follows: #include "fintrf.h" C Gateway subroutine subroutine mexfunction(nlhs

compilation error whith boost-python and lapack

[亡魂溺海] 提交于 2019-12-25 07:27:18
问题 I created a program using boost for extracting python variables and lapack for solving matrix. However I have some trouble in compilation process Here are my includes and the firsts line of code : #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include "lapacke.h" #include <math.h> #include <omp.h> #include <stdlib.h> #include <stdint.h> #include <stdio.h> #include <stdarg.h> #include <math.h> #include <sys/times.h> #include <exception> #include <fstream> #include <iostream> #include

Inaccurate zheev eigen values and vectors

☆樱花仙子☆ 提交于 2019-12-25 01:58:52
问题 I use the LAPACK zheev routine in a Fortran scientific code to compute both eigenvalues and vectors of a matrix not too big (likely to never exceed size 1000). Since this step happens at the beginning of the computation I have to achieve a great accuracy to avoid important error propagation. The problem is that the accuracy of the computation is only about 1e-9 in my test case (with a 12x12 matrix only) and that is not enough at all. I compared with numpy.linalg.eigh which give ridiculously

Calling DPOTRS from LAPACK within C on GNU/Linux

会有一股神秘感。 提交于 2019-12-25 00:04:04
问题 I'd like to seek some help with the DPOTRS function from LAPACK when being called from within C. Yes, I am aware that the matrix I am trying to work with is positive definite (with Eigenvalues 3, 1 in fact!) Right now my function doesn't work correctly. It returns an incorrect result. double A[] = {2.0, 1.0, 1.0, 2.0}; double b[] = {1.5, 0.0}; printf("%5.3f %5.3f\n", b[0], b[1]); info = dpotrs('U',2,1,A,2,b,2); printf("%d\n", info); printf("%5.3f %5.3f\n", b[0], b[1]); This is the code.

The difference between C++ (LAPACK, sgels) and Python (Numpy, lstsq) results

▼魔方 西西 提交于 2019-12-24 10:45:22
问题 I am comparing the numerical results of C++ and Python computations. In C++, I make use of LAPACK's sgels function to compute the coefficients of a linear regression problem. In Python, I use Numpy's linalg.lstsq function for a similar task. What is the mathematical difference between the methods used by sgels and linalg.lstsq? What is the expected error (e.g. 6 significant digits) when comparing the results (i.e. the regression coefficients) numerically? FYI: I am by no means a C++ or Python

Solve Equations Of Type A*X = B Using dgtsv_ or sgtsv_

社会主义新天地 提交于 2019-12-24 02:31:11
问题 I am trying to solve a system of linear equations of the type: A*X = B in SWIFT. I have been able to do this using LU factorization based algorithm that consumes O(N^2) memory. Since my arrays are generally big (10000 samples and more), I am looking at LAPACK that has some functions specific to tridiagonal matrices which consumes only O(N) memory space & are more efficient. http://www.netlib.org/lapack/explore-html-3.4.2/d4/d62/group__double_g_tsolve.html# Essentially, I am looking to solve

Ordering of eigenvectors when calculating eigenvectors using LAPACK's ssteqr

邮差的信 提交于 2019-12-24 00:58:51
问题 I am using LAPACK's ssteqr function to calculate eigenvalues/eigenvectors. The documentation for ssteqr says that the eigenvalues are sorted "in ascending order" . Is it reasonable to assume that the list of eigenvectors is also sorted in ascending order? 回答1: Yes, it is reasonable to assume that the eigenvectors are ordered so that the i -th eigenvector corresponds to the i -th eigenvalue. Nevertheless, if I were you, I would check for each eigenvalue the result of the multiplication of the

How do I get specified Eigenvectors from the generalized Schur factorization of a matrix pair using LAPACK?

假装没事ソ 提交于 2019-12-23 18:12:06
问题 I am grad student trying to rewrite my MATLAB prototype code into C++ code using Eigen and LAPACK. Generalised eigenvalue solver (A*x=lamba*B*x) takes some part in this program. Because Eigen's generalised eigen solver could result in wrong eigenvalue (in my experience), I decided to go with LAPACK (using Accelerate framework in OS X) The code below is the C++ translation of tgevc example http://www.nag.com/numeric/fl/manual/pdf/F08/f08ykf.pdf that I wrote. Everything looks fine unless I

errors using lapack C header in C++ with visual studio 2010

ぃ、小莉子 提交于 2019-12-23 10:55:14
问题 Please help me! It takes me hours to look up in the internet and I haven't found a solution.... I am trying to use the call lapack function from C++ functions but I failed at the very beginning. Here is my code: #include "stdafx.h" #include "targetver.h" extern "C" { #include "lapacke.h" } int main{} { return 0; } I know "lapacke.h" is a C header so I use the extern "C" clause. But while I try to compile this trivial function, I have the following error: Error 1 error C2146: syntax error :