Despite rigorous use and development since 2005, the project is considered a beta relase until sufficient feedback for the sourceforge project is available.
Matrix A(10); // Create a vector (10x1). ... double d = A[0]; // Zero based indexing of the matrix as a real-only vector. A[1] = d*4.0; // Set a real value in the vector. A.PrintStdout(4); // Print A to the standard output with a precision of 4.
The Matrix treated as a real-only matrix:
Matrix A(2,2); // Create a matrix (2x2). ... double d = A[0][0]; // Zero based indexing of the matrix as a real-only matrix. A[0][1] = d*4.0;
The Matrix can be treated as a complex vector:
Matrix A(10); // Create a vector (10x1). ... double d = A(0).real(); // Zero based indexing of the matrix as a complex vector. double v = A(0).imag(); A(1) = d; // set a real value std::complex<double> q(1.0,-2.0); A(2) = q; // set a complex value
or as a complex matrix:
Matrix A(2,2); // Create a matrix (2x2). ... std::complex<double> c = B(0,0); double r = A(0,1).real(); double i = A(0,1).imag(); std::complex<double> w(1.0,-2.0); A(1,1) = w;
e.g. "Data.txt" which is delimited by tabs.
Matrix A; bool result; result = A.ReadFromFile("Data.txt");
e.g. "Data.csv" which is delimited by commas.
Matrix A; bool result; result = A.ReadFromFile("Data.csv");
Matrices can be also stored as lossless compressed binary files.
e.g. "Data.mtx" is a compressed binary matrix file.
Matrix A; bool result; result = A.ReadFromFile("Data.mtx");
Matrix A = "[ 1 2 3; 4 5 6; 7 8 9 ]"; // set the matrix from a string. bool result; result = A.PrintStdout();
Output to file.
Matrix A = "[ 1 2 3; 4 5 6; 7 8 9 ]"; // set the matrix from a string. bool result; result = A.Print("A.txt",6); // output with a precision of 6 (i.e. 6 significant digits).
Append to file.
Matrix A = "[ 1 2 3; 4 5 6; 7 8 9 ]"; // set the matrix from a string. bool result; result = A.Print("A.txt",6,true); // output in append mode with a precision of 6 (i.e. 6 significant digits).
Output to a lossless compressed binary file.
Matrix A = "[ 1 2 3; 4 5 6; 7 8 9 ]"; // set the matrix from a string. bool result; result = A.Save("A.mtx"); // save to a compressed binary using a method balanced for speed and compression efficiency.
Output to a comma delimited file.
Matrix A = "[ 1 2 3; 4 5 6; 7 8 9 ]"; // set the matrix from a string. bool result; result = A.PrintDelimited("A.csv",6,','); // output to a comma delimited file with a precision of 6.
bool result; Matrix X = "[ 1 2 3 4 5 6 7 8 9 10 ]"; // set the matrix from a string, row vector. Matrix Y = X^2; result = Plot( "testplot.bmp", "Y=X^2", "X (m)", "Y (m)", X, Y, "Y=X^2", "(m^2)" );
Equivalently, there is a member function for plotting columns of the matrix vs each other.
bool result; X = "[ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; ]"; // set the matrix from a string, column vector. result = X.Concatonate( X^2 ); result = X.Plot( 0, 1, "testplot2.bmp", "Y=X^2", "X (m)", "Y (m)", "Y=X^2", "(m^2)" );
Multiple series may be plotted with the member function.
bool result; X = "[ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; ]"; // set the matrix from a string, column vector. Y = X; result = X.Concatonate( Y^2 ); result = X.Concatonate( Y^3 ); result = X.Plot( 0, 1, 2, "testplot3.bmp", "Y=X^2", "X (m)", "Y (m)", "Y=X^2", "(m^2)", "Y=X^3", "(m^3)" );
Plotting multiple series.
X = "[ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; ]"; // set the matrix from a string, column vector. Matrix Y1 = X^(0.5); Matrix Y2 = X; Matrix Y3 = X^2; Matrix Y4 = X^3; result = Plot( "testplot4.bmp", "Y as function of X", "X (m)", "Y (m)", X, Y1, "Y=sqrt(X)", "sqrt(m)", X, Y2, "Y=(X)", "(m)", X, Y3, "Y=X^2", "(m^2)", X, Y4, "Y=X^3", "(m^3)" );
This license is categorized as a BSD-style license (refer http://en.wikipedia.org/wiki/Bsd_license).
Redistribution pertains to the following files and their contents.
Redistribution and use in source and binary forms, with or without modification, of the specified files is permitted provided the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Version 0.02 Beta
Version 0.03 Beta
Version 0.04 Beta
Version 0.05 Beta
Version 0.06 Beta
Version 0.07 Beta
The Basic Version utilizes the KISS FFT software libary (http://sourceforge.net/projects/kissfft/, also BSD license).
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.