FAQ - Octave. This is a list of frequently asked questions (FAQ) for GNU Octave users. Feel free to edit this page with your changes. If you have general questions about GNU Octave, or need help for something that is not covered by the Octave manual or the FAQ, please use the help@octave. Before posting a question to the help@octave. By default, the line editing commands are similar to the cursor movement commands used by GNU Emacs, and a vi- style line editing interface is also available. At the end of each session, the command history is saved, so that commands entered during previous sessions are not lost. Access to the complete text of the manual is available via the doc command at the GNU Octave prompt.
When talking about the two projects at the same time, GNU Octave is usually referred to as Octave core (or just core). Octave- Forge also serves as a test bed for code that may eventually end up in the core, and distributes binaries for systems with a lack of developers tools (mainly Windows). It seems that universities use it for research and teaching, companies of all sizes, for development, individuals.
The gcc program accepts options and file names as operands. Many options have multi-letter names; therefore multiple single-letter options may not be grouped: -dv is very different from -d -v. Compiling 32- and 64-bit Windows binaries on Linux, cross-compiling, using gcc. Hi, Are you using a 64-bit Linux distribution? You can check this with $ uname -m x86 I installed using the process BUT this release is quite old. The gcc.gnu.org page suggests current stable release is 4.4 while the MinGW installer installs 3.4. Also this installer has g77 which is no longer a part of GNU compiler suite, its replaced by fortran95. DJGPP is a complete 32-bit C/C++ development system for Intel 80386 (and higher) PCs running DOS. It includes ports of many GNU development utilities. The development tools require a 80386 or newer computer to run, as do the programs they produce.
This question comes often on Octave mailing lists, see Who Uses Octave? Eaton at the University of Texas. Eaton was the original author of Octave, starting full- time development in February 1. He is still the primary maintainer. The community of users/developers has in addition contributed some code and fuels the discussion on the mailing lists help@octave.
It's named after Octave Levenspiel, a former professor of John who was famous for his ability to do quick back- of- the- envelope calculations. You can hear John pronounce the name . We hope that GNU Octave will help perform computations with the same ease as Dr.
This meant agreeing to consider Octave a part of the GNU Project and support the efforts of the FSF. A big part of this effort is to adhere to the GNU coding standards and to benefit from GNU's infrastructure (e. Additionally, Octave receives sponsorship from the FSF's Working Together fund. However, Octave is not and has never been developed by the FSF.
It is recommended to use the stable version of octave for general use, and the development version if you want the latest features and are willing to tolerate instability. The file Change. Log in the source distribution contains a more detailed record of changes made since the last release.
There are two ways to install gcc on windows. It already comes with the installation package of Code::Blocks IDE. So, if you are using Code::Blocks IDE, then you already have GCC installed in your computer. But if you want to install just GCC and not the entire.
Binary distributions exist at least for Debian, SUSE, Fedora and Red. Hat Linuxes (Intel and AMD CPUs, at least), for Mac OS X and Windows' 9. XP, Vista, and 7. If possible, the Fortran subroutines are compiled with the system's Fortran compiler, and called directly from the C++ functions. If that's not possible, you can still compile Octave if you have the free Fortran to C translator f. Eaton, David Bateman, S\oren Hauberg, and Rik Wehbring.
The other. is giving details on the system used so that experiments can be replicated. Send us patches if you can.
If you can't, some developers may be convinced to work on your specific problem for some money. Participate in the help. Many people who now contribute to Octave first spent. A good way to learn Octave is to understand the problems other. Octave as a whole, but it also prepares you to be a better Octave.
These are. also important tasks. The documentation is easy to patch, and the help text.
Editing this wiki is even easier. Find and report. bugs, making an attempt to. Eventually, you will also know how to fix them. If you want. to help with bug reports or patches, subscribe to. See. also the list of short projects.
In other words, the MEX file must use the MEX interface only, and not also call on other Octave internals. It should be possible in principle to use the MEX file with other programs that implement the MEX interface (e. Matlab). The MEX file should not be distributed together with Octave in such a way that they effectively create a single work. For example, you should not distribute the MEX file and Octave together in a single package such that Octave automatically loads and runs the MEX file when it starts up. There are other possible ways that you might effectively create a single work; this is just one example. A program that embeds the Octave interpreter (e.
The original reason for implementing the MEX interface for Octave was to allow Octave to run free software that uses MEX files (the particular goal was to run Sundials. TB in Octave). The intent was to liberate that software from Matlab and increase the amount of free software available to Octave users, not to enable people to write proprietary code for Octave. For the good of the community, we strongly encourage users of Octave to release the code they write for Octave under terms that are compatible with the GPL. Will you change the license of the Octave libraries for me?
Instead of asking us to change the licensing terms for Octave, we recommend that you release your program under terms that are compatible with the GPL so that the free software community can benefit from your work the same as you have benefited from the work of all the people who have contributed to Octave. It's released under a BSD license! While the BSD licenses does allow one to use such code in Octave, it also allows others to further impose restrictions which Mathworks does through the MATLAB Central Terms of Use of their site. Content submitted to File Exchange may only be used with Math. Works products. It should suffice - - although interpretations of this vary - - to contact the author directly and have them send you the code personally, or download the code from the author's own website, if available. Some examples of letters/email sent to authors can be found in the page Asking for package to be released under GPL: examples. Release of official windows binaries.
Experimental support for classdef. Open. GL graphics with Qt widgets. Several functions for reading, writing, and recording of audio.
What's new in version series 3. X of Octave. Open.
GL graphics with fltk widgets. Support for nested functions. Support for java packages in Octave core.
Reading and writing of image files vastly extended. What's new in version series 3. X of Octave. Broadcasting enabled for all built- in binary element- wise operators. Performance of all m- file string functions has been improved. What's new in version series 3.
X of Octave. It is available on the web at http: //www. Good starting points are the Octave Wiki http: //wiki. Octave- Forge http: //octave. We also have an IRC chat room, #octave in Freenode. How do I know, and who should I tell?
When you report a bug, make sure to describe the type of computer you are using, the version of the operating system it is running, and the version of Octave that you are using. Also provide enough code and configuration details of your operating system so that the Octave maintainers can duplicate your bug. It should be possible to make Octave work on other systems as well. If you are interested in porting Octave to other systems, please contact the maintainers' mailing list.
What is this Octave app in the Google Play store? Please see Android for more information. This is a sad turn of events. Once installed, Octave requires approximately 3. MB of disk space (again, considerably less if you don't compile with debugging symbols, approximately 5.
MB). You will also need GCC 4. GCC 4. 4 or later is recommended. Octave's Makefiles use features of GNU Make that are not present in other versions of make. GNU Make is very portable and easy to install.
Octave is intended to be portable to any standard conforming compiler. If you have difficulties that you think are bugs, please report them to the http: //bugs.
For example, you may type. See the previous example. The major advantage of this is that as # is also a comment character for unix script files, any file that starts with a string like #! See the previous example. Also, double- quoted strings include backslash interpretation (like C++, C, and Perl) while single quoted are uninterpreted (like Matlab and Perl). See the previous example. As with Matlab, the end (or endfunction) keyword that marks the end of a function defined in a .
Octave includes the C- like increment and decrement operators ++ and - - in both their prefix and postfix forms, in addition to +=, - =, *=, /=, ^=.+=.- =.*=, ./= and .^=. This would add one to x and then return the new value of x as the result of the expression. It is exactly the same as the expression x = x + 1. This adds one to the variable x, but returns the value that x had prior to incrementing it. For example, if x is equal to 2, the result of the expression x++ is 2, and the new value of x is 3. The general form of an unwind. The statements in cleanup are guaranteed to be executed regardless of how control exits body.
Octave also has on. Cleanup since version 3. These functions are built in to the interpreter. Sections Techniques Used for Linear Algebra and Linear Algebra on Sparse Matrices from the manual describe this procedure. If you want to execute a function defined in a file, just call the function like any other Octave function: foo(arg.
To execute a script from within Octave, just type its name without the . Thus, if you have a script called foo. Octave to execute it.
You have to make sure that the script is in your current path. Type path in Octave to see what this path is, and type pwd to print the working directory (where you're currently standing). The current working directory is referred to as . Unlike calling the script from inside Octave, this also allows you to pass arguments from the shell into the script, which the script can access using the argv command. In a Unix environment, if the script has a shebang (e.
This function searches the help text of all functions for a specific string and returns a list of functions. Note that by default it will only search the first line of the help text (check help lookfor at the octave prompt for more).
The following example helps to find the function to calculate correlation coefficient in a matrix.
For example, the - c option says not to run the linker. Then the output consists of object files output by the assembler. Some options control the preprocessor and others the compiler itself. Yet other options control the. If the description for a particular option does not mention a source language, you can use.
Many options have multi- letter names; therefore multiple single- letter options may. For the most part, the order you use doesn't matter. Order does matter when you use several options of the same.
L more than once, the directories are searched in the order specified. Also, the placement of the - l option is. Most of. these have both positive and negative forms; the negative form of - ffoo would be - fno- foo.
This manual documents only one of these two forms. Explanations are in the following sections. GCC is capable of.
Note that you must link with the libobjc library to make an Objective- C program work. Note that you must link with the libobjc library to make an Objective- C ++ program work. Note that in . cxx, the last two letters must both be literally x. Likewise. . C refers to a literal capital C. Such files are also called specs.
Such files are also called bodies. Any file name with no recognized suffix is treated this way. This. option applies to all following input files until the next - x option.
Possible values for language are. Turn off any specification of a language, so that subsequent files are handled according to their file name suffixes (as they are if - x has not been. If you specify. - pass- exit- codes, the gcc program will instead return with numerically highest error produced by any phase that returned an error indication. The. C, C ++ , and Fortran frontends return 4, if an internal compiler error is encountered.
Note that some combinations (for example, - x cpp- output - E) instruct gcc. The linking stage simply is not done. The ultimate output is in the form of an object file for each. The output is in the form of an assembler code file for each non- assembler input file. The output is in the form of preprocessed source code, which is sent to the standard.
This applies regardless to whatever sort of output is being produced, whether it be an executable file, an object file, an. C code. Also print the version number of the compiler driver program and of. This is useful for shell scripts to capture the driver- generated. This fails to work on some systems where the assembler is. GNU assembler has no trouble.
This will allow intermodule analysis ( IMA ) to be performed by the compiler. Currently the only language for. C. If you pass source files for multiple languages to the driver, using this option, the driver will invoke the compiler(s) that. IMA once each, passing each compiler all the source files appropriate for it. For those languages that do not support IMA.
If you use this option in conjunction with. If the - v option is also specified then. If the. - Wextra option has also been specified (prior to the - -help option), then command line options which have no documentation associated with them. For some targets extra target- specific information may. Unlike the - -target- help option however, target- specific options of the linker and assembler will not be.
This is because those tools do not currently support the extended - -help= syntax. One case where it does work. So for example to display all the target- specific optimization options the following can be used. The - -help= option can be repeated on the command line.
Each successive use will display its requested class of options, skipping those that have. It takes a single comma separated list as an argument, which will be used to invoke the wrapper. This will invoke all subprograms of gcc under . The options read are inserted in place of the original @file option.
If file does not exist, or. A whitespace character may be included in an option by surrounding the entire option in either single or.
Any character (including a backslash) may be included by prefixing the character to be included with a backslash. The file may itself. GCC recognizes files with these names and compiles them as C ++ programs even. C programs (usually with the name gcc). This program is also useful when precompiling a C header file with a . C. ++ compilations.
On many systems, g++ is also installed with the name c++. In C ++ mode, it is equivalent to - std=c++9. It also enables the undesirable and rarely used ISO trigraph. For the C compiler, it disables recognition of C ++ style // comments as well as the . Alternate predefined macros such as .
For that, - pedantic is required in addition to - ansi. Some header files may notice this macro and refrain from declaring. ISO standard doesn't call for; this is to avoid interfering with any programs that might. This option is currently only supported when compiling C or C ++ .
By specifying a base standard, the compiler will accept all programs following that standard and those using GNU extensions. For example, - std=c. GCC that are incompatible with ISO C9.
On the other hand, by specifying a GNU dialect of a standard, all features the. The. particular standard is used by - pedantic to identify which features are GNU extensions given that version of the standard. For example. - std=gnu. C ++ style // comments, while - std=gnu. Same as. - ansi for C code.
Note that this standard is not yet fully supported; see < http: //gcc. The names c. 9x and iso. This is the default for C code.
When ISO C9. 9 is fully implemented in GCC , this will become the default. Same as - ansi for C ++ code. This is the default for C ++ code. This option enables experimental features that are likely to be. C ++ 0x. The working draft is constantly changing, and any feature that is enabled by this flag may be removed from future versions. GCC if it is not part of the C ++ 0x standard.
This option enables experimental features that may be removed in future versions of GCC. This option is accepted and ignored by GCC versions 4. In GCC versions 4. GCC in C9. 9 mode. Using this option is roughly equivalent to adding the . This option was first supported in GCC 4. This option is not supported in C8.
This. option is silently ignored in any language other than C. In the case of function definitions, a. K& R- style list of arguments followed by their declarations is also provided, inside comments, after the declaration.
You can use the. keywords . You may. want to use the - fno- gnu- keywords flag instead, which has the same effect. In C9. 9 mode (- std=c. The resulting code is often both.
In addition, when a function is recognized as a built- in function, GCC may use information about. For example, warnings are given with - Wformat for bad calls to . If a function is named that is not built- in in this version of GCC , this option is ignored. There is no corresponding. This implies - fbuiltin. A hosted environment is one in which the entire standard library. Examples are nearly everything except a kernel.
This is equivalent to. This implies - fno- builtin. A freestanding environment is one in which the standard. The most obvious example is an OS kernel. This is. equivalent to - fno- hosted.
When - fopenmp is specified, the. Open. MP Application Program Interface v. This option implies.
The - ansi option (and - std options for strict ISO C conformance) implies. This option allows a user supplied . The user supplied compilation step can then add in an additional preprocessing step after normal preprocessing but before compiling. The default is to. The semantics of this option will change if . They are now only supported with the - E switch.
See the GNU CPP manual for details. The value of such an expression is void. This option is not supported. C ++ . This option should not be used for new.
This option, and its inverse, let you make such a program work with the opposite default. Likewise, the option. By. default, such a bit- field is signed, because this is consistent: the basic integer types such as . For example, you might compile a file . Version 2 is the version of the C ++ ABI that first appeared in G++ 3. Version 1 is. the version of the C ++ ABI that first appeared in G++ 3.
Version 0 will always be the version that conforms most closely to the C ++. ABI specification. Therefore, the ABI obtained using version 0 will change as ABI bugs are fixed. This switch is mainly useful for working around bugs in the access control code. This check is normally unnecessary. C ++ standard specifies that .
In all other cases, when . See also new (nothrow). This saves space in the executable at the cost of not.
If you compile with this flag and your program mysteriously crashes after . Friend functions.
Annotated C ++ Reference Manual, and versions of G++ before 4. However, in. ISO C ++ a friend function which is not declared in an enclosing scope can only be found using argument dependent lookup. This. option causes friends to be injected as they were in earlier releases. This option violates the C ++ standard, but may be useful. NDEBUG . This does not give user code permission to throw exceptions in. If - fno- for- scope is specified, the scope of variables declared in a for- init- statement extends to the end of. G++, and other (traditional) implementations of C ++ .
You can use the keyword . The default is to handle inlines differently so that compiles with and without. This will cause linker errors if these. Currently, the only such diagnostic issued by G++ is the one for a name having. Thus, using - fpermissive will allow some nonconforming code to.
This option also implies - fno- implicit- templates. If you don't use those parts of the language, you can save some space by using this flag. Note that exception handling. This information is generally only useful to the G++ development team.
This assumption. may not be valid if the program uses a cast to convert an arbitrary integer value to the enumeration type. A limit on the template instantiation depth is needed to detect endless recursions. ANSI/ISO C ++ conforming programs must not rely on a maximum depth greater than 1.