fir1 in octave with boxcar - function

I have to make filter, this is my code:
octave:1> x=randn(500);
octave:2> b=fir1(50,0.2,'stop',boxcar(51));
error: `boxcar' undefined near line 2 column 22
error: evaluating argument list element number 4
What is problem here?
Also Low-pass filter is 'low' or 'stop' in Octave?
#edit
New error:
octave:2> b=fir1(50,0.2,'stop');
error: `fir1' undefined near line 2 column 3
is it possible I don't have something?

You probably need to load the package (see the Octave FAQ). Run pkg list to confirm the package is installed and whether it is loaded. It will display a table of all installed packages with an asterisk in front of the packages that are loaded. You won't be able to use packages that are not loaded. See the following Octave session.
octave> partcnt (7) # does not work because function is not in search path
error: `partcnt' undefined near line 9 column 1
octave> pkg list # show list of packages
Package Name | Version | Installation directory
---------------+---------+-----------------------
control | 2.4.1 | /home/carandraug/octave/control-2.4.1
general | 1.3.2 | /home/carandraug/octave/general-1.3.2
generate_html | 0.1.5 | /home/carandraug/octave/generate_html-0.1.5
image | 2.1.0 | /home/carandraug/octave/image-2.1.0
miscellaneous | 1.2.0 | /home/carandraug/octave/miscellaneous-1.2.0
optim | 1.2.2 | /home/carandraug/octave/optim-1.2.2
signal | 1.2.0 | /home/carandraug/octave/signal-1.2.0
specfun | 1.1.0 | /home/carandraug/octave/specfun-1.1.0
struct | 1.0.10 | /home/carandraug/octave/struct-1.0.10
octave> pkg load miscellaneous # load package
octave> partcnt (7) # it works now
ans = 15
octave> pkg list # confirm that package is loaded (* in front of the name)
Package Name | Version | Installation directory
---------------+---------+-----------------------
control | 2.4.1 | /home/carandraug/octave/control-2.4.1
general *| 1.3.2 | /home/carandraug/octave/general-1.3.2
generate_html | 0.1.5 | /home/carandraug/octave/generate_html-0.1.5
image | 2.1.0 | /home/carandraug/octave/image-2.1.0
miscellaneous *| 1.2.0 | /home/carandraug/octave/miscellaneous-1.2.0
optim | 1.2.2 | /home/carandraug/octave/optim-1.2.2
signal | 1.2.0 | /home/carandraug/octave/signal-1.2.0
specfun | 1.1.0 | /home/carandraug/octave/specfun-1.1.0
struct | 1.0.10 | /home/carandraug/octave/struct-1.0.10
octave> pkg unload all # unload the package
octave> partcnt (7) # no longer works because it was removed from path
error: `partcnt' undefined near line 15 column 1
octave> pkg list
Package Name | Version | Installation directory
---------------+---------+-----------------------
control | 2.4.1 | /home/carandraug/octave/control-2.4.1
general | 1.3.2 | /home/carandraug/octave/general-1.3.2
generate_html | 0.1.5 | /home/carandraug/octave/generate_html-0.1.5
image | 2.1.0 | /home/carandraug/octave/image-2.1.0
miscellaneous | 1.2.0 | /home/carandraug/octave/miscellaneous-1.2.0
optim | 1.2.2 | /home/carandraug/octave/optim-1.2.2
signal | 1.2.0 | /home/carandraug/octave/signal-1.2.0
specfun | 1.1.0 | /home/carandraug/octave/specfun-1.1.0
struct | 1.0.10 | /home/carandraug/octave/struct-1.0.10
The reason why the general package is loaded automatically when you load miscellaneous, is because general is a dependency of miscellaneous.

From the man page:
usage: b = fir1(n, w [, type] [, window] [, noscale])
You probably want e.g.:
b=fir1(50, [0.1 0.2], 'stop');

Related

nvcc and clang are not working well together when installing pytorch-gpu

I am trying to install pytorch with gpu support on my MacBook Pro following official instructions.
Things go smoothly until an error occurred:
[ 70%] Building NVCC (Device) object caffe2/CMakeFiles/caffe2_gpu.dir/__/aten/src/THC/caffe2_gpu_generated_THCTensorMath.cu.o
nvcc fatal : The version ('90000') of the host compiler ('Apple clang') is not supported
nvcc fatal : The version ('90000') of the host compiler ('Apple clang') is not supported
CMake Error at caffe2_gpu_generated_THCBlas.cu.o.Release.cmake:219 (message):
Error generating
/Users/username/Dev/pytorch-gpu/pytorch/build/cCaMfafkee2 /ECrMraokre Faitle sc/acfaffef2e_2g_pgup_ug.ednierr/a_t_e/da_tTeHnC/Sslrece/pT.HcCu/..o/.cRaeflfeea2s_eg.pcum_agkeen:e2r1a9t e(dm_eTsHsCaBglea)s:.
It seems that CUDA and clang are not working well together.
I searched over internet and found these posts, but they did not solve my problem:
Revert Apple Clang Version For NVCC
https://github.com/pytorch/pytorch/issues/3047
Here's my environment:
macOS Sierra 10.12.6 (16G1618)
NVIDIA GeForce GT 750M
CUDA Driver Version: 387.178
GPU Driver Version: 378.05.05.25f11
Cuda compilation tools, release 8.0, V8.0.61
(Previous)Apple LLVM version 9.0.0 (clang-900.0.39.2)
(After downgrade)Apple LLVM version 8.1.0 (clang-802.0.42)
Xcode Version 9.2 (9C40b)
I am answering my own question.
Incorrect CUDA installation on macOS could be a nightmare. The versions of CUDA, Xcode, clang and macOS really matter. Here are some of the official tested ones:
+------+--------------+------------+---------------------------------+--------+
| CUDA | Xcode | Apple LLVM | Mac OSX Version (native x86_64) | Yes/No |
+------+--------------+------------+---------------------------------+--------+
| 8.0 | 7.2 | 7.0.3 | 10.11 | YES |
| 8.0 | 7.2 | 7.0.3 | 10.12 | NO |
| 8.0 | 8.2 | 8.0.0 | 10.11 | NO |
| 8.0 | 8.2 | 8.0.0 | 10.12 | YES |
| 9.0 | 8.3.3 | 8.1.0 | 10.12 | YES |
| 9.1 | 9.2 | 9.0.0 | 10.13.3 | YES |
| 9.2 | 9.2 | 9.0.0 | 10.13.5 | YES |
| 10.0 | 9.4 | 9.0.0 | 10.13.6 | YES |
| 10.1 | 10.1 (10B61) | 10.0.0 | 10.13.6 (17G2307) | YES |
+------+--------------+------------+---------------------------------+--------+
For CUDA Releases before 8.0, please search for NVIDIA CUDA INSTALLATION GUIDE FOR MAC OS X plus the CUDA version number, there should be a table of version matching in that PDF file.

Parsing JSON in native Tizen

I've got a Native C project in which I need to parse some Json. According to something I found in Tizen documentation the json-glibc parser is included in the SDK. So I tried using it. Here is a minimal program that creates the parser and nothing more.
#include <json-glib.h>
main(int argc, char *argv[])
{
JsonParser* jsonParser = NULL;
GError *error = NULL;
jsonParser = json_parser_new();
if(jsonParser == NULL) {
fputs("failed to create parser", stderr);
exit(7);
}
return 0;
}
In the Tizen 3.0 emulator this works fine. As soon as I try it in the 2.3.2 emulator or on 2.3.2 hardware it fails. It strikes ms as odd that such a thing would be hardware/firmware dependent. Does anyone know if there is something I should do so that I can create the parser on either version of the hardware?
Update 10月6日2018年
I think this is a bug with the 2.3.x emulator for more recent installs. This is only a hypothesis as the most I can do is try fresh installs on fresh operating systems. My only other hypothesis is that there is some component that the 2.3.x emulator needs to function that is missing and not documented as a requirement.
+-----------------------------------+------+--------+--------------------------+
| OS Version | Tizen|Studio | Result |
+-----------------------------------+------+--------+--------------------------+
| Ubuntu 16 LTS Clean Install | 2.3 | 2.4 | json_parser_new()== NULL |
| Ubuntu 16 LTS Clean Install | 2.3 | 2.5 | json_parser_new()== NULL |
| Ubuntu 18 LTS Clean Install | 2.3 | 2.4 | json_parser_new()== NULL |
| Ubuntu 18 LTS Clean Install | 2.3 | 2.5 | json_parser_new()== NULL |
| Mac OS X High Siera Clean Install | 2.3 | 2.5 | json_parser_new()== NULL |
| Mac OS X Movaje Clean Install | 2.3 | 2.5 | json_parser_new()== NULL |
| Windows 10 Creator's Edition | 2.3 | 2.5 | json_parser_new()== NULL |
| Windows 10 Creator's Edition | 2.3 | 2.4 | json_parser_new()== NULL |
| Ubuntu 16 LTS Clean Install | 3.0 | 2.4 | success |
| Ubuntu 16 LTS Clean Install | 3.0 | 2.5 | success |
| Ubuntu 18 LTS Clean Install | 3.0 | 2.4 | success |
| Ubuntu 18 LTS Clean Install | 3.0 | 2.5 | success |
| Mac OS X High Siera Clean Install | 3.0 | 2.5 | success |
| Mac OS X Movaje Clean Install | 3.0 | 2.5 | success |
| Windows 10 Creator's Edition | 3.0 | 2.5 | success |
| Windows 10 Creator's Edition | 3.0 | 2.4 | success |
+-----------------------------------+---------------+--------------------------+
From these results one would think that Tizen 2.3 isn't supported. But it is and it appears that people that have installed Tizen Studio sometime before now can successfully execute the same code.
enter link description hereI got an answer to my question over the the Tizen developer's forums.
Long story short, the Gear S3+ and the Gear S2 use different versions of GLIB. On the one used on the Gear S2 is glib_init() isn't called first attempts to create objects will fail.
The following needs to be added before using any glib library to avoid this problem.
#if !GLIB_CHECK_VERSION(2, 35, 0)
g_type_init();
#endif

Octave: Installing package not successful

Trying to install the package communications-1.2.1.tar.gz on my windows-64-system leads to the following error message. What do I have to do to get it running?
genqamdemod.cc: In function 'octave_value_list Fgenqamdemod(const octave_value_list&, int)':
genqamdemod.cc:39:23: warning: 'int empty_arg(const char*, octave_idx_type, octave_idx_type)' is deprecated (declared at C:\Program
s\Octave\include\octave-4.2.1\octave\../octave/utils.h:58): use 'octave_value::is_empty' instead [-Wdeprecated-declarations]
int arg_is_empty1 = empty_arg ("genqamdemod", nr1, nc1);
^
genqamdemod.cc:39:57: warning: 'int empty_arg(const char*, octave_idx_type, octave_idx_type)' is deprecated (declared at C:\Program
s\Octave\include\octave-4.2.1\octave\../octave/utils.h:58): use 'octave_value::is_empty' instead [-Wdeprecated-declarations]
int arg_is_empty1 = empty_arg ("genqamdemod", nr1, nc1);
^
In file included from galois.h:24:0,
from galois-def.cc:21:
C:\Programs\Octave\include\octave-4.2.1\octave\../octave/config.h:28:2: warning: #warning "config.h has been deprecated; there is n
o need to include it directly" [-Wcpp]
#warning "config.h has been deprecated; there is no need to include it directly"
^
In file included from galois-def.cc:21:0:
galois.h:25:28: fatal error: octave/base-lu.h: No such file or directory
#include <octave/base-lu.h>
^
compilation terminated.
make: *** [galois-def.o] Error 1
make: Entering directory `/tmp/oct-2OnYWD/communications-1.2.1/src'
C:/Programs/Octave/bin/mkoctfile-4.2.1.exe -DGALOIS_DISP_PRIVATES __errcore__.cc -o __errcore__.oct
C:/Programs/Octave/bin/mkoctfile-4.2.1.exe -DGALOIS_DISP_PRIVATES __gfweight__.cc -o __gfweight__.oct
C:/Programs/Octave/bin/mkoctfile-4.2.1.exe -DGALOIS_DISP_PRIVATES cyclgen.cc -o cyclgen.oct
C:/Programs/Octave/bin/mkoctfile-4.2.1.exe -DGALOIS_DISP_PRIVATES cyclpoly.cc -o cyclpoly.oct
C:/Programs/Octave/bin/mkoctfile-4.2.1.exe -DGALOIS_DISP_PRIVATES genqamdemod.cc -o genqamdemod.oct
C:/Programs/Octave/bin/mkoctfile-4.2.1.exe -DGALOIS_DISP_PRIVATES -c galois-def.cc -o galois-def.o
make: Leaving directory `/tmp/oct-2OnYWD/communications-1.2.1/src'
pkg: error running `make' for the communications package.
error: called from
configure_make at line 95 column 9
install at line 192 column 7
pkg at line 394 column 9
The following table shows the result of pkg list.
Package Name | Version | Installation directory
---------------------+---------+-----------------------
control | 3.0.0 | C:\Programs\Octave\share\octave\packages\control-3.0.0
data-smoothing | 1.3.0 | C:\Programs\Octave\share\octave\packages\data-smoothing-1.3.0
database | 2.4.2 | C:\Programs\Octave\share\octave\packages\database-2.4.2
dataframe | 1.1.0 | C:\Programs\Octave\share\octave\packages\dataframe-1.1.0
dicom | 0.1.1 | C:\Programs\Octave\share\octave\packages\dicom-0.1.1
financial | 0.5.0 | C:\Programs\Octave\share\octave\packages\financial-0.5.0
fits | 1.0.7 | C:\Programs\Octave\share\octave\packages\fits-1.0.7
fuzzy-logic-toolkit | 0.4.5 | C:\Programs\Octave\share\octave\packages\fuzzy-logic-toolkit-0.4.5
ga | 0.10.0 | C:\Programs\Octave\share\octave\packages\ga-0.10.0
general | 2.0.0 | C:\Programs\Octave\share\octave\packages\general-2.0.0
generate_html | 0.1.13 | C:\Programs\Octave\share\octave\packages\generate_html-0.1.13
geometry | 2.1.1 | C:\Programs\Octave\share\octave\packages\geometry-2.1.1
gsl | 2.0.0 | C:\Programs\Octave\share\octave\packages\gsl-2.0.0
image | 2.6.1 | C:\Programs\Octave\share\octave\packages\image-2.6.1
instrument-control | 0.2.3 | C:\Programs\Octave\share\octave\packages\instrument-control-0.2.3
interval | 2.1.0 | C:\Programs\Octave\share\octave\packages\interval-2.1.0
io | 2.4.5 | C:\Programs\Octave\share\octave\packages\io-2.4.5
linear-algebra | 2.2.2 | C:\Programs\Octave\share\octave\packages\linear-algebra-2.2.2
lssa | 0.1.2 | C:\Programs\Octave\share\octave\packages\lssa-0.1.2
ltfat | 2.2.0 | C:\Programs\Octave\share\octave\packages\ltfat-2.2.0
mapping | 1.2.1 | C:\Programs\Octave\share\octave\packages\mapping-1.2.1
miscellaneous | 1.2.1 | C:\Programs\Octave\share\octave\packages\miscellaneous-1.2.1
nan | 3.1.2 | C:\Programs\Octave\share\octave\packages\nan-3.1.2
netcdf | 1.0.11 | C:\Programs\Octave\share\octave\packages\netcdf-1.0.11
nurbs | 1.3.10 | C:\Programs\Octave\share\octave\packages\nurbs-1.3.10
ocs | 0.1.5 | C:\Programs\Octave\share\octave\packages\ocs-0.1.5
odepkg | 0.8.5 | C:\Programs\Octave\share\octave\packages\odepkg-0.8.5
optim | 1.5.2 | C:\Programs\Octave\share\octave\packages\optim-1.5.2
quaternion | 2.4.0 | C:\Programs\Octave\share\octave\packages\quaternion-2.4.0
queueing | 1.2.5 | C:\Programs\Octave\share\octave\packages\queueing-1.2.5
signal | 1.3.2 | C:\Programs\Octave\share\octave\packages\signal-1.3.2
sockets | 1.2.0 | C:\Programs\Octave\share\octave\packages\sockets-1.2.0
sparsersb | 1.0.2 | C:\Programs\Octave\share\octave\packages\sparsersb-1.0.2
specfun | 1.1.0 | C:\Programs\Octave\share\octave\packages\specfun-1.1.0
splines | 1.3.2 | C:\Programs\Octave\share\octave\packages\splines-1.3.2
statistics | 1.3.0 | C:\Programs\Octave\share\octave\packages\statistics-1.3.0
stk | 2.3.4 | C:\Programs\Octave\share\octave\packages\stk-2.3.4
strings | 1.2.0 | C:\Programs\Octave\share\octave\packages\strings-1.2.0
struct | 1.0.14 | C:\Programs\Octave\share\octave\packages\struct-1.0.14
tisean | 0.2.3 | C:\Programs\Octave\share\octave\packages\tisean-0.2.3
tsa | 4.4.5 | C:\Programs\Octave\share\octave\packages\tsa-4.4.5
video | 1.2.3 | C:\Programs\Octave\share\octave\packages\video-1.2.3
windows | 1.2.4 | C:\Programs\Octave\share\octave\packages\windows-1.2.4
zeromq | 1.2.1 | C:\Programs\Octave\share\octave\packages\zeromq-1.2.1
I believe just a re-installation will do --> https://www.gnu.org/software/octave/#install
following the instructions exactly.

mvn flyway:baseline does not run my V1_0__baseline.sql script

I have an existing MySQL database. I dumped the schema out to a file named V1_0__baseline.sql which I placed in src/main/resources/db/migration.
My pom.xml looks just like the example in the docs.
mvn flyway:clean will destroy any existing tables and remove the database.
mvn flyway:baseline will create the database but only creates the schema_version table -- it does not seem to run any of the SQL in my V1_0__baseline.sql file.
mvn flyway:info reports:
+---------+------------------------+---------------------+---------+
| Version | Description | Installed on | State |
+---------+------------------------+---------------------+---------+
| 1.0 | baseline | 2016-03-16 00:15:24 | Success |
| 2.1 | oauth integrations | | Pending |
| 2.2 | base unified reporting | | Pending |
+---------+------------------------+---------------------+---------+
From reading the docs that is not what I expected. I thought it would run all the SQL in my V1_0__baseline.sql file and give me my starting schema.
Have I completely misunderstood or am I missing something that would make this work as I imagined?

How to save a single webpage with a Linux server

I'm trying to save data descriptions from the open data site with a Linux server via SSH:
https://dandelion.eu/datagems/SpazioDati/milano-grid/resource/
https://dandelion.eu/datagems/SpazioDati/milano-grid/description/
I've read the question (What's the best way to save a complete webpage on a linux server?) and tried wget -l 1 https://dandelion.eu/datagems/SpazioDati/milano-grid/description/ and wget -m https://dandelion.eu/datagems/SpazioDati/milano-grid/description/. Neither of them worked. All I can get is an index.html. I want to have the files that I can get using IE/Firefox's 'Save Page' function 'Web page, complete' on a PC. There should be an html file and a folder containing all the stuff like images and such.
Is this possible on a Linux server via SSH? Thanks!
Update
This is what I want (I 'Save page' https://dandelion.eu/datagems/SpazioDati/milano-grid/description/ with Firefox):
|---Milano Grid description _ dandelion_files
| |---a
| |---css_all.css
| |---css.css
| |---dc.js
| |---fbk.jpg
| |---jquery_002.js
| |---jquery.js
| |---js_all.js
| |---js_sitebase.js
| |---Milano_GRID_4326.png
| |---milano-grid-img2.jpg
| |---mixpanel-2.js
| |---odi.png
| |---sbi.css
| |---spaziodati_black.png
| |---spaziodati_white.png
| |---telecom.png
|---Milano Grid description _ dandelion.htm
This is what I get with wget -p -k https://dandelion.eu/datagems/SpazioDati/milano-grid/description/:
|---dandelion.eu
| |---datagems
| | |---SpazioDati
| | | |---milano-grid
| | | | |---resource
| | | | | |---index.html
| |---jsi18n
| | |---index.html
| |---robots.txt