octave

BLAS and LAPACK libraries required for compiling

随声附和 提交于 2019-12-01 02:09:38
问题 I recently downloaded the latest stable release of Gnu Octave, and was attempting to build and install it on my machine (Ubuntu 10.0.4 LTS 64bit). When I run ./configure, I got this error message: configure: error: You are required to have BLAS and LAPACK libraries Does anyone know Where do I obtain these libraries from? 回答1: Try to run this apt-get install libblas-dev libatlas-dev liblapack-dev All libraries, required by octave package in ubuntu are listed here: http://packages.ubuntu.com

How to invoke octave script in unix shell

浪尽此生 提交于 2019-12-01 01:26:46
I have written an octave script file (.m) If anyone could point me out on how to run octave scripts on unix shell that would be really helpful. I do not want to execute the script by invoking octave program. I am new to unix and octave. Thanks in advance Yes, of course you can write an Octave program. Like so: $ cat octave_program #!/usr/bin/env octave ## Never forget your licence at the top of the files. 1; function [rv] = main (argv) disp ("hello world"); rv = 0; return; endfunction main (argv); $ chmod a+x octave_program # add executable permissions $ ./octave_program hello world There's a

How do you perform conditional assignment in arrays in Julia?

旧街凉风 提交于 2019-12-01 00:54:52
问题 In Octave, I can do octave:1> A = [1 2; 3 4] A = 1 2 3 4 octave:2> A(A>1) -= 1 A = 1 1 2 3 but in Julia, the equivalent syntax does not work. julia> A = [1 2; 3 4] 2x2 Array{Int64,2}: 1 2 3 4 julia> A[A>1] -= 1 ERROR: `isless` has no method matching isless(::Int64, ::Array{Int64,2}) in > at operators.jl:33 How do you conditionally assign values to certain array or matrix elements in Julia? 回答1: Your problem isn't with the assignment, per se, it's that A > 1 itself doesn't work. You can use

Converting Matlab to Octave is there a containers.Map equivalent?

北战南征 提交于 2019-12-01 00:01:15
问题 I am trying to convert some matlab code from the Maia package into something that will work with Octave. I am currently getting stuck because one of the files has several calls to containers.Map which is apparently something that has not yet been implemented in octave. Does anyone have any ideas for easily achieving similar functionality without doing a whole lot of extra work in octave? Thanks all for your time. function [adj_direct contig_direct overlap names longest_path_direct... weigth

Matlab/Octave 1-of-K representation

丶灬走出姿态 提交于 2019-11-30 20:34:28
I have a y of size 5000,1 (matrix), which contains integers between 1 and 10. I want to expand those indices into a 1-of-10 vector. I.e., y contains 1,2,3... and I want it to "expand" to: 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 What is the best way to do that? I tried: Y = zeros(5000,10); Y(y) = 1; but it didn't work. It works for vectors though: if y = [2 5 7] , and Y = zeros(1,10) , then Y(y) = [0 1 0 0 1 0 1 0 0 0] . cyborg n=5 Y = ceil(10*rand(n,1)) Yexp = zeros(n,10); Yexp(sub2ind(size(Yexp),1:n,Y')) = 1 Also, consider using sparse, as in: Creating Indicator Matrix .

How to graph adjacency matrix using MATLAB

我的未来我决定 提交于 2019-11-30 19:54:32
I want to create a plot showing connections between nodes from an adjacency matrix like the one below. gplot seems like the best tool for this. However, in order to use it, I need to pass the coordinate of each node. The problem is that I don't know where the coordinates should be, I was hoping the function would be capable of figuring out a good layout for me. For example here's my output using the following arbitrary coordinates: A = [1 1 0 0 1 0; 1 0 1 0 1 0; 0 1 0 1 0 0; 0 0 1 0 1 1; 1 1 0 1 0 0; 0 0 0 1 0 0]; crd = [0 1; 1 1; 2 1; 0 2; 1 2; 2 2]; gplot (A, crd, "o-"); Which is hard to

How to invoke octave script in unix shell

青春壹個敷衍的年華 提交于 2019-11-30 19:34:23
问题 I have written an octave script file (.m) If anyone could point me out on how to run octave scripts on unix shell that would be really helpful. I do not want to execute the script by invoking octave program. I am new to unix and octave. Thanks in advance 回答1: Yes, of course you can write an Octave program. Like so: $ cat octave_program #!/usr/bin/env octave ## Never forget your licence at the top of the files. 1; function [rv] = main (argv) disp ("hello world"); rv = 0; return; endfunction

Octave c++ and VS2010

最后都变了- 提交于 2019-11-30 14:58:56
问题 I'm trying to Use Octave with Visual C++. I have downloaded octave-3.6.1-vs2010-setup-1.exe. Created a new project, added octave include folder to include path, octinterp.lib and octave.lib to lib path, and I added Octave bin folder as running directory. The program compiles and runs fine except feval function that causes the exception: Microsoft C++ exception: octave_execution_exception at memory location 0x0012faef and on Octave side: Invalid resizing operation or ambiguous assignment to an

Replace all zeros in vector by previous non-zero value

馋奶兔 提交于 2019-11-30 14:32:24
问题 Matlab/Octave algorithm example: input vector: [ 1 0 2 0 7 7 7 0 5 0 0 0 9 ] output vector: [ 1 1 2 2 7 7 7 7 5 5 5 5 9 ] The algorithm is very simple: it goes through the vector and replaces all zeros with the last non-zero value. It seems trivial, and is so when done with a slow for (i=1:length) loop and being able to refer to the previous element (i-1), but looks impossible to be formulated in the fast vectorized form. I tried the merge() and shift() but it only works for the first

Matlab, how to calculate AUC (Area Under Curve)?

谁说我不能喝 提交于 2019-11-30 14:08:51
问题 I have the file data.txt with two columns and N rows, something like this: 0.009943796 0.4667975 0.009795735 0.46777886 0.009623984 0.46897832 0.009564759 0.46941447 0.009546991 0.4703958 0.009428543 0.47224948 0.009375241 0.47475737 0.009298249 0.4767201 [...] Every couple of values in the file correspond to one point coordinates (x,y). If plotted, this points generate a curve. I would like to calculate the area under curve (AUC) of this curve. So I load the data: data = load("data.txt"); X