armadillo

armadillo C++ matrix library — how to enable use of ATLAS or LAPACK?

£可爱£侵袭症+ 提交于 2019-12-08 05:51:10
问题 When i compile example2.cpp with armadillo makefile and run it i am getting an error message error: det(): use of ATLAS or LAPACK needs to be enabled How do i fix that? I have similar errors when i try to use solve. Details of my setup are: Ubuntu Lucid Lynx 10.04 Armadillo version: 2.4.2 (Loco Lounge Lizard) ATLAS 3.9.51 BOOST 1.48.0 g++ (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3 Atlas was installed before armadillo was, armadillo installation was configured with Cmake. I am far from an expert in cmake

Armadillo + Matlab Mex segfault

北城以北 提交于 2019-12-07 23:25:32
问题 I fiddled with this the whole day, so I thought I might make everyone benefit from my experience, please see my answer below. I first had a problem with running a compiled Mex file within Matlab, because Matlab complained that it couldn't open the shared library libarmadillo . I solved this using the environment variables LD_LIBRARY_PATH and LD_RUN_PATH ( DYLD_LIBRARY_PATH and LYLD_RUN_PATH in osx). The problem remained however, that a simple test file would segfault at runtime even though

C++ - framework for computing PCA (other than armadillo)

梦想的初衷 提交于 2019-12-07 22:37:54
问题 I have a large dataset of around 200000 data points where each data point contains 132 features. So basically my dataset is 200000 x 132 . I have done all the computations by using the armadillo framework. However, I have tried to do PCA analysis but I received a memory error which I don't know that it's because of my RAM memory( 8 GB of Ram ) or its a limitation due to the framework itself. I receive the following error : requested size is too large . Can you recommend me another framework

Column means 3d matrix (cube) Rcpp

断了今生、忘了曾经 提交于 2019-12-07 20:11:05
问题 I have a program in which I need to calculate repeatedly the column means of each slice of a cube X(nRow, nCol, nSlice) in Rcpp, with the resulting means forming a matrix M(nCol, nSlice) . The following code produced an error: #include <RcppArmadillo.h> // [[Rcpp::depends(RcppArmadillo)]] using namespace Rcpp; using namespace arma; // [[Rcpp::export]] mat cubeMeans(arma::cube X){ int nSlice = X.n_slices; int nCol = X.n_cols; int nRow = X.n_rows; arma::vec Vtmp(nCol); arma::mat Mtmp(nRow, nCol

Why do I get errors installing precompiled versions of LAPACK on Windows?

雨燕双飞 提交于 2019-12-07 17:22:23
问题 I am trying to use the Armadillo matrix library to do matrix calcualtions and it needs BLAS and LAPACK. The Armadillo documentation recommended getting the precompiled versions from http://www.stanford.edu/~vkl/code/libs.html There are .lib and .dll files in there. The only problem is I don't know how to get Visual Studio (Express Edition 2008) to recognize these files. I try to copy them to the Visual C++ include and lib directories C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC

How do I draw multinomial distributed samples with RcppArmadillo?

大兔子大兔子 提交于 2019-12-07 09:00:18
问题 The problem is that I have a variable arma::mat prob_vec and want something equivalent to rmultinom(1, 1, prob_vec) in R. I found the rmultinom function provided by RcppArmadillo has a weird argument requirement which is different from that in R! So it won't pass the compilation. I just wanna know how to draw the desired sample in RcppArmadillo, or equivalently in Armadillo. If I need to get the pointer or convert my prob_vec variable, please tell me how. Many thanks! 回答1: Your friendly

Accessing view of a NumPy array using the C API

℡╲_俬逩灬. 提交于 2019-12-07 08:17:12
问题 In a Python extension module I've written in C++, I use the following snippet of code to convert a NumPy array into an Armadillo array for use in the C++ portion of the code: static arma::mat convertPyArrayToArma(PyArrayObject* pyarr, int nrows, int ncols) { // Check if the dimensions are what I expect. if (!checkPyArrayDimensions(pyarr, nrows, ncols)) throw WrongDimensions(); const std::vector<int> dims = getPyArrayDimensions(pyarr); // Gets the dimensions using the API PyArray_Descr*

faster than scan() with Rcpp?

我与影子孤独终老i 提交于 2019-12-06 23:15:41
问题 Reading ~5x10^6 numeric values into R from a text file is relatively slow on my machine (a few seconds, and I read several such files), even with scan(..., what="numeric", nmax=5000) or similar tricks. Could it be worthwhile to try an Rcpp wrapper for this sort of task (e.g. Armadillo has a few utilities to read text files)? Or would I likely be wasting my time for little to no gain in performance because of an expected interface overhead? I'm not sure what's currently limiting the speed

Efficient parallelisation of a linear algebraic function in C++ OpenMP

 ̄綄美尐妖づ 提交于 2019-12-06 14:16:22
问题 I have little experience with parallel programming and was wondering if anyone could have a quick glance at a bit of code I've written and see, if there are any obvious ways I can improve the efficiency of the computation. The difficulty arises due to the fact that I have multiple matrix operations of unequal dimensionality that I need to compute, so I'm not sure the most condensed way of coding the computation. Below is my code. Note this code DOES work. The matrices I am working with are of

C++ - framework for computing PCA (other than armadillo)

守給你的承諾、 提交于 2019-12-06 12:11:47
I have a large dataset of around 200000 data points where each data point contains 132 features. So basically my dataset is 200000 x 132 . I have done all the computations by using the armadillo framework . However, I have tried to do PCA analysis but I received a memory error which I don't know that it's because of my RAM memory( 8 GB of Ram ) or its a limitation due to the framework itself. I receive the following error : requested size is too large . Can you recommend me another framework for PCA computation which doesn't have size/memory limtations? Or if you have previously used armadillo