読者です 読者をやめる 読者になる 読者になる

のねのBlog

パソコンやソフト開発で起きた問題など書きます。よろしくお願いします。

octave bsxfun

> help bsxfun
'bsxfun' is a built-in function from the file libinterp/corefcn/bsxfun.cc

 -- bsxfun (F, A, B)
     The binary singleton expansion function performs broadcasting, that
     is, it applies a binary function F element-by-element to two array
     arguments A and B, and expands as necessary singleton dimensions in
     either input argument.

     F is a function handle, inline function, or string containing the
     name of the function to evaluate.  The function F must be capable
     of accepting two column-vector arguments of equal length, or one
     column vector argument and a scalar.

     The dimensions of A and B must be equal or singleton.  The
     singleton dimensions of the arrays will be expanded to the same
     dimensionality as the other array.

     See also: arrayfun, cellfun.

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at http://www.octave.org and via the help@octave.org
mailing list.

broadcastとsingletonってなんだろ?
singleton dimensions:大きさが1の次元という意味らしい。

: bsxfun (f, A, B)
The binary singleton expansion function performs broadcasting,
 that is, it applies a binary function f 
element-by-element to two array arguments A and B, 
and expands as necessary singleton dimensions in either input argument.

f is a function handle, inline function,
 or string containing the name of the function to evaluate.
 The function f must be capable of accepting 
two column-vector arguments of equal length,
 or one column vector argument and a scalar.

The dimensions of A and B must be equal or singleton. 
The singleton dimensions of the arrays 
will be expanded to the same dimensionality as the other array.

See also: arrayfun, cellfun.

www.gnu.org

stackoverflow.com

jp.mathworks.com

static constの配置場所

stackoverflow.com

d.hatena.ne.jp

セクションとか.textとか

定数が何故スタック領域に配置されるのか - 109: 開発ツール - Forum - かふぇルネ - Renesas Rulz - Japan
より、引用

Renesasの場合
① const static char[] = "A" : C-1セクション
② static const char[] = "B" : C-1セクション
③ const         char[] = "C" : スタックエリア
④               char[] = "D" : スタックエリア
⑤        static char[] = "E" : R-1、D-1セクション(初期値付き変数)

SourceTree 外部マージツールが起動しない

ターミナルを開き以下のコマンドを実行してみた。
(SourceTreeのメニュー>操作>ターミナルで開く)

.gitglobalの確認

$ git config --global --list
core.autocrlf=true
core.excludesfile=C:\Users\user01\Documents\gitignore_global.txt
user.name=user01
user.email=user01@gmail.com

difftool.sourcetree.cmd=
'C:/Program Files/WinMerge/WinMergeU.exe' "$LOCAL" "$REMOTE"

difftool.WinMerge.cmd=
'C:/Program Files/WinMerge/WinMergeU.exe'
 -e -r -u -x -wl -wr -dl "a/$MERGED" -dr "b/$MERGED" "$LOCAL" "$REMOTE"

difftool.WinMerge.trustexitcode=false

merge.tool=WinMerge
mergetool.WinMerge.cmd="C:/WinMerge/WinMergeU.exe" 
   //e //u //wl //wr "$LOCAL" "$BASE" "$REMOTE" //o "$MERGED"
mergetool.WinMerge.trustexitcode=true

コマンドでマージツールを起動してみる。
WinMergeのパスがおかしいようだ。

$ git mergetool
Merging:
/mingw64/libexec/git-core/git-mergetool--lib: line 136: 
C:/WinMerge/WinMergeU.exe: No such file or directory
merge of folder/file.h failed
Continue merging other unresolved paths (y/n) ? n

value is "true" or "false"
--int value is decimal number
--bool-or-int value is --bool or --int
--path value is a path (file or directory name)

Other
-z, --null terminate values with NUL byte
--name-only show variable names only
--includes respect include directives on lookup

$ git config --global --list
core.autocrlf=true
core.excludesfile=C:\Users\m_fujii\Documents\gitignore_global.txt
user.name=user01
user.email=user01@gmail.com

diff.tool=WinMerge

difftool.prompt=false

difftool.WinMerge.cmd=
  'C:/Program Files/WinMerge/WinMergeU.exe'
   -e -r -u -x -wl -wr -dl "a/$MERGED" -dr "b/$MERGED" "$LOCAL" "$REMOTE"
difftool.WinMerge.trustexitcode=false


merge.tool=WinMerge

mergetool.prompt=false

mergetool.keepbackup=false

mergetool.WinMerge.cmd=
  'C:/Program Files/WinMerge/WinMergeU.exe' "$MERGED"

mergetool.WinMerge.trustexitcode=false

起動するようになった。

$ git mergetool

Gitが、おもしろいほどわかる基本の使い方33〈バージョン管理、SourceTree、Bitbucket〉

Gitが、おもしろいほどわかる基本の使い方33〈バージョン管理、SourceTree、Bitbucket〉

GitHub実践入門 ~Pull Requestによる開発の変革 (WEB+DB PRESS plus)

GitHub実践入門 ~Pull Requestによる開発の変革 (WEB+DB PRESS plus)

qiita.com

Octave max

>> help max
'max' is a built-in function from the file libinterp/corefcn/max.cc

 -- max (X)
 -- max (X, [], DIM)
 -- [W, IW] = max (X)
 -- max (X, Y)
     Find maximum values in the array X.

     For a vector argument, return the maximum value.  For a matrix
     argument, return a row vector with the maximum value of each
     column.  For a multi-dimensional array, 'max' operates along the
     first non-singleton dimension.

     If the optional third argument DIM is present then operate along
     this dimension.  In this case the second argument is ignored and
     should be set to the empty matrix.

     For two matrices (or a matrix and a scalar), return the pairwise
     maximum.

     Thus,

          max (max (X))

     returns the largest element of the 2-D matrix X, and

          max (2:5, pi)
              =>  3.1416  3.1416  4.0000  5.0000

     compares each element of the range '2:5' with 'pi', and returns a
     row vector of the maximum values.

     For complex arguments, the magnitude of the elements are used for
     comparison.  If the magnitudes are identical, then the results are
     ordered by phase angle in the range (-pi, pi].  Hence,

          max ([-1 i 1 -i])
              => -1

     because all entries have magnitude 1, but -1 has the largest phase
     angle with value pi.

     If called with one input and two output arguments, 'max' also
     returns the first index of the maximum value(s).  Thus,

          [x, ix] = max ([1, 3, 5, 2, 5])
              =>  x = 5
                  ix = 3

     See also: min, cummax, cummin.

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at http://www.octave.org and via the help@octave.org
mailing list.

Octave fmincg options

>> help optimset
'optimset' is a function from the file 
    C:\Octave\Octave-4.2.0\share\octave\4.2.0\m\optimization\optimset.m

 -- optimset ()
 -- OPTIONS = optimset ()
 -- OPTIONS = optimset (PAR, VAL, ...)
 -- OPTIONS = optimset (OLD, PAR, VAL, ...)
 -- OPTIONS = optimset (OLD, NEW)
     Create options structure for optimization functions.

     When called without any input or output arguments, 'optimset'
     prints a list of all valid optimization parameters.

     When called with one output and no inputs, return an options
     structure with all valid option parameters initialized to '[]'.

     When called with a list of parameter/value pairs, return an options
     structure with only the named parameters initialized.

     When the first input is an existing options structure OLD, the
     values are updated from either the PAR/VAL list or from the options
     structure NEW.

     Valid parameters are:
     AutoScaling
     ComplexEqn

Displayは、デフォルトオフなんだ。

     Display
          Request verbose display of results from optimizations.  Values
          are:

          "off" [default]
               No display.

          "iter"
               Display intermediate results for every loop iteration.

          "final"
               Display the result of the final loop iteration.

          "notify"
               Display the result of the final loop iteration if the
               function has failed to converge.
     FinDiffType

FunValCheck
When enabled, display an error if the objective function
returns an invalid value (a complex number, NaN, or Inf).
Must be set to "on" or "off" [default]. Note: the functions
'fzero' and 'fminbnd' correctly handle Inf values and only
complex values or NaN will cause an error in this case.
|

Octave Plot

>> figure;  % 図を表示するためのウィンドウを開く
>> hold on; % 続けて表示するようにする。
>> plot(1,1,'bo', 'MarkerSize', 10);
>> plot(2,2,'rx', 'MarkerSize', 10);
>> plot(3,3,'c+', 'MarkerSize', 10);
>> hold off; %解除

f:id:none53:20170208185309p:plain

Octaveの精義―フリーの高機能数値計算ツールを使いこなす

Octaveの精義―フリーの高機能数値計算ツールを使いこなす

> help plot
'plot' is a function from the file C:\Octave\Octave-4.2.0\share\octave\4.2.0\m\plot\draw\plot.m

 -- plot (Y)
 -- plot (X, Y)
 -- plot (X, Y, FMT)
 -- plot (..., PROPERTY, VALUE, ...)
 -- plot (X1, Y1, ..., XN, YN)
 -- plot (HAX, ...)
 -- H = plot (...)
     Produce 2-D plots.

     Many different combinations of arguments are possible.  The
     simplest form is

          plot (Y)

     where the argument is taken as the set of Y coordinates and the X
     coordinates are taken to be the range '1:numel (Y)'.

     If more than one argument is given, they are interpreted as

          plot (Y, PROPERTY, VALUE, ...)

     or

          plot (X, Y, PROPERTY, VALUE, ...)

     or

          plot (X, Y, FMT, ...)

     and so on.  Any number of argument sets may appear.  The X and Y
     values are interpreted as follows:

        * If a single data argument is supplied, it is taken as the set
          of Y coordinates and the X coordinates are taken to be the
          indices of the elements, starting with 1.

        * If X and Y are scalars, a single point is plotted.

        * 'squeeze()' is applied to arguments with more than two
          dimensions, but no more than two singleton dimensions.

        * If both arguments are vectors, the elements of Y are plotted
          versus the elements of X.

        * If X is a vector and Y is a matrix, then the columns (or rows)
          of Y are plotted versus X.  (using whichever combination
          matches, with columns tried first.)

        * If the X is a matrix and Y is a vector, Y is plotted versus
          the columns (or rows) of X.  (using whichever combination
          matches, with columns tried first.)

        * If both arguments are matrices, the columns of Y are plotted
          versus the columns of X.  In this case, both matrices must
          have the same number of rows and columns and no attempt is
          made to transpose the arguments to make the number of rows
          match.
>||
     Multiple property-value pairs may be specified, 
     but they must appear in pairs.  
     These arguments are applied to the line objects drawn by 'plot'.  

      Useful properties to modify are 

     "linestyle",
     "linewidth",
     "color",
     "marker",
     "markersize",
     "markeredgecolor",
     "markerfacecolor".  *Note Line Properties::.
     The FMT format argument can also be used to control the plot style.
     It is a string composed of four optional parts:
     "<linestyle><marker><color><;displayname;>". 

     When a marker is specified, 
     but no linestyle, only the markers are plotted.
     
     Similarly, if a linestyle is specified, 
     but no marker, then only lines are drawn.

     If both are specified then lines and markers will be plotted.  

     If no FMT and no PROPERTY/VALUE pairs are given,
     then the default plot style is solid lines with no markers 
     and the color determined by the "colororder" property of the current axes.
     Format arguments:

     linestyle

          '-'  Use solid lines (default).
          '--' Use dashed lines.
          ':'  Use dotted lines.
          '-.' Use dash-dotted lines.

     marker

          '+'  crosshair
          'o'  circle
          '*'  star
          '.'  point
          'x'  cross
          's'  square
          'd'  diamond
          '^'  upward-facing triangle
          'v'  downward-facing triangle
          '>'  right-facing triangle
          '<'  left-facing triangle
          'p'  pentagram
          'h'  hexagram

     color

          'k'  blacK
          'r'  Red
          'g'  Green
          'b'  Blue
          'y'  Yellow
          'm'  Magenta
          'c'  Cyan
          'w'  White

     ";displayname;"
          Here "displayname" is the label to use for the plot legend.
     The FMT argument may also be used to assign legend labels.  To do
     so, include the desired label between semicolons after the
     formatting sequence described above, e.g., "+b;Key Title;".  Note
     that the last semicolon is required and Octave will generate an
     error if it is left out.

     Here are some plot examples:

          plot (x, y, "or", x, y2, x, y3, "m", x, y4, "+")

     This command will plot 'y' with red circles, 'y2' with solid lines,
     'y3' with solid magenta lines, and 'y4' with points displayed as
     '+'.

          plot (b, "*", "markersize", 10)

     This command will plot the data in the variable 'b', with points
     displayed as '*' and a marker size of 10.

          t = 0:0.1:6.3;
          plot (t, cos(t), "-;cos(t);", t, sin(t), "-b;sin(t);");

     This will plot the cosine and sine functions and label them
     accordingly in the legend.

     If the first argument HAX is an axes handle, then plot into this
     axis, rather than the current axes returned by 'gca'.

     The optional return value H is a vector of graphics handles to the
     created line objects.

     To save a plot, in one of several image formats such as PostScript
     or PNG, use the 'print' command.

     See also: axis, box, grid, hold, legend, title, xlabel, ylabel,
     xlim, ylim, ezplot, errorbar, fplot, line, plot3, polar, loglog,
     semilogx, semilogy, subplot.

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at http://www.octave.org and via the help@octave.org
mailing list.