Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/mtimesx_RealTimesReal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
* MATLAB (R) is a trademark of The Mathworks (R) Corporation
*
* Filename: mtimesx_RealTimesReal.c
* Programmer: James Tursa
* Version: 1.41
* Date: February 23, 2011
* Copyright: (c) 2009, 2010, 2011 by James Tursa, All Rights Reserved
* Programmer: James Tursa, Quanlong He
* Version: 1.50
* Date: July 12, 2017
* Copyright: (c) 2009, 2010, 2011 by James Tursa,
* 2017 by Quanlong He,
* All Rights Reserved
*
* This code uses the BSD License:
*
Expand Down Expand Up @@ -47,6 +49,7 @@
* Expanded sparse * single and sparse * nD support
* Fixed (nD complex scalar)C * (nD array) bug.
* 2011/Feb/23 --> 1.41, Fixed typos in _syrk and _syr2k BLAS prototypes.
* 2017/Jul/12 --> 1.50, Add Octave support.
*
****************************************************************************/

Expand Down Expand Up @@ -6914,13 +6917,22 @@ mxArray *RealScalarTimesReal(mxArray *A, char transa, mwSize m1, mwSize n1,
if( debug_message ) {
mexPrintf("MTIMESX: Shared data copy\n");
}
#ifdef OCTAVE
// Octave does not provide fast copy API
result = mxDuplicateArray(B);
#else
result = mxCreateSharedDataCopy(B);
#endif
return result;
} else if( (Bdims[0] == 1 || Bdims[1] == 1) && (transb == 'T' || (transb == 'C' && Bpi == NULL)) ) {
if( debug_message ) {
mexPrintf("MTIMESX: Shared data copy\n");
}
#ifdef OCTAVE
result = mxDuplicateArray(B);
#else
result = mxCreateSharedDataCopy(B);
#endif
Cdims = mxMalloc( Bndim * sizeof(*Cdims) );
for( Cp=2; Cp<Bndim; Cp++) {
Cdims[Cp] = Bdims[Cp];
Expand Down
21 changes: 17 additions & 4 deletions src/mtimesx_build.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
%
% Function: mtimesx_build
% Filename: mtimesx_build.m
% Programmer: James Tursa
% Version: 1.40
% Date: October 4, 2010
% Copyright: (c) 2009, 2010 by James Tursa, All Rights Reserved
% Programmer: James Tursa, Quanlong He
% Version: 1.50
% Date: July 12, 2017
% Copyright: (c) 2009, 2010 by James Tursa,
% 2017 by Quanlong He,
% All Rights Reserved
%
% This code uses the BSD License:
%
Expand Down Expand Up @@ -93,6 +95,17 @@ function mtimesx_build(x)
error('Too many outputs. Expected none.');
end

%\
% Check for Octave
%/
%
disp('... Checking for Octave');
octave = (exist ('OCTAVE_VERSION', 'builtin') > 0);
if( octave )
mkoctfile('--mex', 'mtimesx.c', '-DOCTAVE', '-lblas');
return
end

%\
% Check for non-PC
%/
Expand Down