[med-svn] [Git][med-team/praat][master] 4 commits: debian/What_s_new_.html: Update upstream ChangeLog

Rafael Laboissiere gitlab at salsa.debian.org
Thu Feb 21 20:06:25 GMT 2019


Rafael Laboissiere pushed to branch master at Debian Med / praat


Commits:
b9abf597 by Rafael Laboissiere at 2019-02-20T20:20:25Z
debian/What_s_new_.html: Update upstream ChangeLog

Gbp-Dch: Ignore

- - - - -
955b4338 by Rafael Laboissiere at 2019-02-20T20:21:45Z
New upstream version 6.0.48
- - - - -
0d03245f by Rafael Laboissiere at 2019-02-20T20:24:16Z
Merge tag 'upstream/6.0.48'

Upstream version 6.0.48

- - - - -
f1500bb1 by Rafael Laboissiere at 2019-02-21T20:05:30Z
Changelog entry for version 6.0.48-1

Gbp-Dch: Ignore

- - - - -


18 changed files:

- debian/What_s_new_.html
- debian/changelog
- dwtest/test_robustStatistics.praat
- fon/Praat_tests.cpp
- fon/Sound.cpp
- fon/Sound.h
- fon/TextGrid_Sound.cpp
- fon/TextGrid_Sound.h
- fon/Vector.cpp
- fon/manual_tutorials.cpp
- fon/praat_ExperimentMFC.cpp
- fon/praat_Sound.cpp
- melder/MAT.cpp
- sys/Formula.cpp
- sys/Graphics_linesAndAreas.cpp
- sys/Graphics_record.cpp
- sys/praat_objectMenus.cpp
- sys/praat_version.h


Changes:

=====================================
debian/What_s_new_.html
=====================================
@@ -7,10 +7,18 @@ What's new?
 <p>
 Latest changes in Praat.</p>
 <p>
+<b>6.0.48</b> (17 February 2019)</p>
+<ul>
+<li>
+ Removed a bug introduced in 6.0.44 whereby Praat could crash when drawing a function without any points.
+<li>
+ Removed a bug whereby Praat would not start up on macOS 10.10 (because of required GPU libraries).
+</ul>
+<p>
 <b>6.0.47</b> (8 February 2019)</p>
 <ul>
 <li>
- Removed a bug introdu ed in 6.0.44 whereby a cepstral peak prominence would be computed incorrectly.
+ Removed a bug introduced in 6.0.44 whereby a cepstral peak prominence would be computed incorrectly.
 </ul>
 <p>
 <b>6.0.46</b> (3 January 2019)</p>
@@ -636,7 +644,7 @@ What used to be new?</h3>
 </ul>
 <hr>
 <address>
-	<p>© ppgb, February 8, 2019</p>
+	<p>© ppgb, February 17, 2019</p>
 </address>
 </body>
 </html>


=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+praat (6.0.48-1) unstable; urgency=medium
+
+  * New upstream version 6.0.48
+
+ -- Rafael Laboissiere <rafael at debian.org>  Wed, 20 Feb 2019 17:24:23 -0300
+
 praat (6.0.47-2) unstable; urgency=medium
 
   * d/t/run-tests: Skip unit tests that fail on mips64el


=====================================
dwtest/test_robustStatistics.praat
=====================================
@@ -27,6 +27,7 @@ procedure location_scale
 	endfor
 	.report$ = Report robust statistics: "chem", 1.5, 1e-8, 30
 	appendInfoLine: .report$
+	removeObject: .tab
 endproc
 
 appendInfoLine: "test_robustStatistics.praat OK"


=====================================
fon/Praat_tests.cpp
=====================================
@@ -55,6 +55,12 @@ static int length (conststring32 s) {
 	return result;
 }
 
+static autoMAT constantHH (integer nrow, integer ncol, double value) {
+	autoMAT result = newMATraw (nrow, ncol);
+	result.all() <<= value;
+	return result;
+}
+
 int Praat_tests (kPraatTests itest, conststring32 arg1, conststring32 arg2, conststring32 arg3, conststring32 arg4) {
 	int64 n = Melder_atoi (arg1);
 	double t = 0.0;
@@ -455,10 +461,15 @@ int Praat_tests (kPraatTests itest, conststring32 arg1, conststring32 arg2, cons
 			MelderInfo_writeLine (sum);
 		} break;
 		case kPraatTests::TIME_MATMUL: {
-			const integer size = Melder_atoi (arg2);
-			autoMAT const x = newMATrandomGauss (size, size, 0.0, 1.0);
-			autoMAT const y = newMATrandomGauss (size, size, 0.0, 1.0);
-			autoMAT const result = newMATraw (size, size);
+			const integer size1 = Melder_atoi (arg2);
+			integer size2 = Melder_atoi (arg3);
+			integer size3 = Melder_atoi (arg4);
+			if (size2 == 0 || size3 == 0) size3 = size2 = size1;
+			//autoMAT const x = newMATrandomGauss (size1, size2, 0.0, 1.0);
+			//autoMAT const y = newMATrandomGauss (size2, size3, 0.0, 1.0);
+			autoMAT x = constantHH (size1, size2, 10.0);
+			autoMAT y = constantHH (size2, size3, 3.0);
+			autoMAT const result = newMATraw (size1, size3);
 			//MAT resultget = result.get();
 			//constMAT xget = x.get(), yget = y.get();
 			MATVU const result_all = result.all();
@@ -467,9 +478,13 @@ int Praat_tests (kPraatTests itest, conststring32 arg1, conststring32 arg2, cons
 			Melder_stopwatch ();
 			for (integer iteration = 1; iteration <= n; iteration ++)
 				MATVUmul_forceMetal_ (result_all, x_all, y_all);
-			t = Melder_stopwatch () / size / size / size;
+			const integer numberOfComputations = size1 * size2 * size3 * 2;
+			t = Melder_stopwatch () / numberOfComputations;
 			const double sum = NUMsum (result.get());
-			MelderInfo_writeLine (sum);
+			const integer numberOfStores = size1 * size2 + size2 * size3 + size1 * size3 + 10000;
+			MelderInfo_writeLine (double (numberOfComputations) / double (numberOfStores), U" computations per store");
+			MelderInfo_writeLine (sum, U" should be ", size1 * size2 * size3 * 30.0);
+			//Melder_require (NUMequal (result.get(), constantHH (size, size, size * 30.0).get()), U"...");
 		} break;
 		case kPraatTests::THING_AUTO: {
 			int numberOfThingsBefore = theTotalNumberOfThings;


=====================================
fon/Sound.cpp
=====================================
@@ -1,6 +1,6 @@
 /* Sound.cpp
  *
- * Copyright (C) 1992-2018 Paul Boersma
+ * Copyright (C) 1992-2019 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -769,7 +769,8 @@ void Sound_draw (Sound me, Graphics g,
 		Domain expressed in sample numbers.
 	*/
 	integer ixmin, ixmax;
-	Matrix_getWindowSamplesX (me, tmin, tmax, & ixmin, & ixmax);
+	integer n = Matrix_getWindowSamplesX (me, tmin, tmax, & ixmin, & ixmax);
+	if (n < 1) return;
 	/*
 		Automatic vertical range.
 	*/
@@ -1270,4 +1271,36 @@ autoSound Sounds_crossCorrelate_short (Sound me, Sound thee, double tmin, double
 	}
 }
 
+Thing_implement (SoundList, Ordered, 0);
+
+integer SoundList_getMinimumNumberOfSamples (SoundList me) {
+	integer result = INTEGER_MAX;
+	for (integer isound = 1; isound <= my size; isound ++)
+		if (my at [isound] -> nx < result)
+			result = my at [isound] -> nx;
+	return result;
+}
+
+autoMAT SoundList_getRandomizedPatterns (SoundList me, integer numberOfPatterns, integer patternSize) {
+	try {
+		integer minimumNumberOfSamples = SoundList_getMinimumNumberOfSamples (me);
+		Melder_require (patternSize <= minimumNumberOfSamples,
+			U"The pattern size cannot be ", patternSize, U", because there is a Sound that is only ", minimumNumberOfSamples, U" samples long.");
+		autoMAT result = newMATzero (numberOfPatterns, patternSize);
+		for (integer ipattern = 1; ipattern <= numberOfPatterns; ipattern ++) {
+			integer soundNumber = NUMrandomInteger (1, my size);
+			Sound sound = my at [soundNumber];
+			integer numberOfSamples = sound -> nx;
+			integer endSample = NUMrandomInteger (patternSize, numberOfSamples);
+			integer startSample = endSample - (patternSize - 1);
+			Melder_assert (startSample >= 1);
+			constVEC const samples = sound -> z.row (1);
+			result.row (ipattern) <<= samples. part (startSample, endSample);
+		}
+		return result;
+	} catch (MelderError) {
+		Melder_throw (me, U": no randomize patterns gotten.");
+	}
+}
+
 /* End of file Sound.cpp */


=====================================
fon/Sound.h
=====================================
@@ -2,7 +2,7 @@
 #define _Sound_h_
 /* Sound.h
  *
- * Copyright (C) 1992-2011,2012,2014,2015,2017 Paul Boersma
+ * Copyright (C) 1992-2005,2006-2008,2010-2019 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -340,5 +340,14 @@ autoSound Sound_lengthen_overlapAdd (Sound me, double fmin, double fmax, double
 autoSound Sound_deepenBandModulation (Sound me, double enhancement_dB,
 	double flow, double fhigh, double slowModulation, double fastModulation, double bandSmoothing);
 
+/*
+	Abstract.
+*/
+Collection_define (SoundList, OrderedOf, Sound) {
+};
+
+integer SoundList_getMinimumNumberOfSamples (SoundList me);
+autoMAT SoundList_getRandomizedPatterns (SoundList me, integer numberOfPatterns, integer patternSize);
+
 /* End of file Sound.h */
 #endif


=====================================
fon/TextGrid_Sound.cpp
=====================================
@@ -1,6 +1,6 @@
 /* TextGrid_Sound.cpp
  *
- * Copyright (C) 1992-2018 Paul Boersma
+ * Copyright (C) 1992-2019 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -452,8 +452,6 @@ autoSoundList TextGrid_Sound_extractAllIntervals (TextGrid me, Sound sound, inte
 	}
 }
 
-Thing_implement (SoundList, Ordered, 0);
-
 autoSoundList TextGrid_Sound_extractNonemptyIntervals (TextGrid me, Sound sound, integer tierNumber, bool preserveTimes) {
 	try {
 		IntervalTier tier = TextGrid_checkSpecifiedTierIsIntervalTier (me, tierNumber);


=====================================
fon/TextGrid_Sound.h
=====================================
@@ -1,6 +1,6 @@
 /* TextGrid_Sound.h
  *
- * Copyright (C) 1992-2011,2013,2014,2015,2017 Paul Boersma
+ * Copyright (C) 1992-2019 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -23,9 +23,6 @@
 void TextGrid_Sound_draw (TextGrid me, Sound sound, Graphics g, double tmin, double tmax,
 	bool showBoundaries, bool useTextStyles, bool garnish);
 
-Collection_define (SoundList, OrderedOf, Sound) {
-};
-
 autoSoundList TextGrid_Sound_extractAllIntervals (TextGrid me, Sound sound, integer tierNumber, bool preserveTimes);
 autoSoundList TextGrid_Sound_extractNonemptyIntervals (TextGrid me, Sound sound, integer tierNumber, bool preserveTimes);
 autoSoundList TextGrid_Sound_extractIntervalsWhere (TextGrid me, Sound sound,


=====================================
fon/Vector.cpp
=====================================
@@ -374,7 +374,8 @@ void Vector_draw (Vector me, Graphics g, double *pxmin, double *pxmax, double *p
 		Domain expressed in sample numbers.
 	*/
 	integer ixmin, ixmax;
-	Matrix_getWindowSamplesX (me, *pxmin, *pxmax, & ixmin, & ixmax);
+	integer n = Matrix_getWindowSamplesX (me, *pxmin, *pxmax, & ixmin, & ixmax);
+	if (n < 1) return;
 	/*
 		Automatic vertical range.
 	*/


=====================================
fon/manual_tutorials.cpp
=====================================
@@ -22,11 +22,14 @@
 void manual_tutorials_init (ManPages me);
 void manual_tutorials_init (ManPages me) {
 
-MAN_BEGIN (U"What's new?", U"ppgb", 20190208)
+MAN_BEGIN (U"What's new?", U"ppgb", 20190217)
 INTRO (U"Latest changes in Praat.")
 //LIST_ITEM (U"• Manual page about @@drawing a vowel triangle at .")
+NORMAL (U"##6.0.48# (17 February 2019)")
+LIST_ITEM (U"• Removed a bug introduced in 6.0.44 whereby Praat could crash when drawing a function without any points.")
+LIST_ITEM (U"• Removed a bug whereby Praat would not start up on macOS 10.10 (because of required GPU libraries).")
 NORMAL (U"##6.0.47# (8 February 2019)")
-LIST_ITEM (U"• Removed a bug introdu ed in 6.0.44 whereby a cepstral peak prominence would be computed incorrectly.")
+LIST_ITEM (U"• Removed a bug introduced in 6.0.44 whereby a cepstral peak prominence would be computed incorrectly.")
 NORMAL (U"##6.0.46# (3 January 2019)")
 LIST_ITEM (U"• Removed a crashing bug in the LongSound window introduced in 6.0.44.")
 LIST_ITEM (U"• Removed a bug causing incorrect conversion from Formant to LPC introduced in 6.0.44.")


=====================================
fon/praat_ExperimentMFC.cpp
=====================================
@@ -44,7 +44,7 @@ DIRECT (WINDOW_ExperimentMFC_run) {
 	{// scope
 		/*
 			This `scope` comment refers to the idea that an autoThing (here, `list`)
-			is created in the beginning of the scope and invalidated at the end of the scope (by `move`).
+			is created at the beginning of the scope and invalidated at the end of the scope (by `move`).
 		*/
 		FIND_TYPED_LIST (ExperimentMFC, ExperimentMFCList)
 		Melder_assert (list->size >= 1);


=====================================
fon/praat_Sound.cpp
=====================================
@@ -355,6 +355,14 @@ DIRECT (NEW1_Sounds_combineToStereo) {
 	CONVERT_LIST_END (U"combined_", numberOfChannels)
 }
 
+DIRECT (NEW1_Sounds_combineIntoSoundList) {
+	CONVERT_LIST (Sound)
+		autoSoundList result = SoundList_create ();
+		for (integer iobject = 1; iobject <= list.size; iobject ++)
+			result -> addItem_move (Data_copy (list.at [iobject]));
+	CONVERT_LIST_END (U"ensemble")
+}
+
 DIRECT (NEW1_Sounds_concatenate) {
 	CONVERT_LIST (Sound)
 		autoSound result = Sounds_concatenate (list, 0.0);
@@ -1990,6 +1998,15 @@ FORM_SAVE (SAVE_Sound_saveAsWavFile, U"Save as WAV file", nullptr, U"wav") {
 	SAVE_TYPED_LIST_END
 }
 
+/***** SOUNDLIST *****/
+
+DIRECT (NEWMANY_Extract_all_Sounds) {
+	CONVERT_EACH (SoundList)
+		autoSoundList result = Data_copy (me);
+		result -> classInfo = classCollection;   // YUCK, in order to force automatic unpacking
+	CONVERT_EACH_END (U"dummy")
+}
+
 /***** STOP *****/
 
 DIRECT (PLAY_stopPlayingSound) {
@@ -2095,7 +2112,7 @@ static int publishPlayedProc () {
 /***** buttons *****/
 
 void praat_Sound_init () {
-	Thing_recognizeClassesByName (classSound, classLongSound, nullptr);
+	Thing_recognizeClassesByName (classSound, classLongSound, classSoundList, nullptr);
 
 	Data_recognizeFileType (macSoundOrEmptyFileRecognizer);
 	Data_recognizeFileType (soundFileRecognizer);
@@ -2389,6 +2406,7 @@ void praat_Sound_init () {
 		praat_addAction1 (classSound, 0, U"Filter (de-emphasis)...", nullptr, 1, NEW_Sound_filter_deemphasis);
 	praat_addAction1 (classSound, 0, U"Combine -", nullptr, 0, nullptr);
 		praat_addAction1 (classSound, 0, U"Combine to stereo", nullptr, 1, NEW1_Sounds_combineToStereo);
+		praat_addAction1 (classSound, 0, U"Combine into SoundList", nullptr, 1, NEW1_Sounds_combineIntoSoundList);
 		praat_addAction1 (classSound, 0, U"Concatenate", nullptr, 1, NEW1_Sounds_concatenate);
 		praat_addAction1 (classSound, 0, U"Concatenate recoverably", nullptr, 1, NEW2_Sounds_concatenateRecoverably);
 		praat_addAction1 (classSound, 0, U"Concatenate with overlap...", nullptr, 1, NEW1_Sounds_concatenateWithOverlap);
@@ -2409,6 +2427,8 @@ void praat_Sound_init () {
 	praat_addAction2 (classLongSound, 0, classSound, 0,   U"Write to NIST file...", U"*Save as NIST file...", praat_DEPRECATED_2011, SAVE_LongSound_Sound_saveAsNistFile);
 	praat_addAction2 (classLongSound, 0, classSound, 0, U"Save as FLAC file...", nullptr, 0, SAVE_LongSound_Sound_saveAsFlacFile);
 	praat_addAction2 (classLongSound, 0, classSound, 0,   U"Write to FLAC file...", U"*Save as FLAC file...", praat_DEPRECATED_2011, SAVE_LongSound_Sound_saveAsFlacFile);
+
+	praat_addAction1 (classSoundList, 1, U"Extract all Sounds", nullptr, 0, NEWMANY_Extract_all_Sounds);
 }
 
 /* End of file praat_Sound.cpp */


=====================================
melder/MAT.cpp
=====================================
@@ -467,18 +467,20 @@ void MATVUmul_forceMetal_ (MATVU const& target, constMATVU const& x, constMATVU
 #ifdef macintosh
 	if (@available (macOS 10.13, *)) {
 		/*
-			The speed is 0.000'003, 0.003, 0.66, 2.24, 3.46,  9.6, 13.0, 20.1, 20.0, 21.0, 27.5, 34.2, 77 Gflop/s
-			for size =           1,    10,  100,  200,  500, 1000, 2000, 3000, 5000, 6000, 7000, 8000, 10000.
+			The speed is 0.000'002, 0.002, 1.00, 8.0, 16.1,  21, 14.3,  35, 16.3,  51,  22,   62,   58,   60,   58,   57,   135,   223,   360,   465,   519,   580,   577,   579,  1125,  1108,  1087,  1175,  1194 Gflop/s
+			for size =           1,    10,  100, 200,  300, 400,  500, 600,  700, 800, 900, 1000, 2000, 3000, 5000, 7000, 10000, 12000, 15000, 17000, 18000, 18500, 18700, 18800, 18900, 19000, 20000, 21000, 22000.
 		*/
 		static bool gpuInited = false;
 		static id <MTLDevice> gpuDevice;
 		static id <MTLCommandQueue> gpuQueue;
 		if (! gpuInited) {
 			gpuDevice = MTLCreateSystemDefaultDevice ();
-			Melder_casual (U"GPU device", Melder_pointer (gpuDevice));
+			autostring32 deviceName = Melder_8to32 ([[gpuDevice name] UTF8String]);
+			Melder_casual (U"GPU device for computing: ", deviceName.get());
 			gpuInited = true;
 			gpuQueue = [gpuDevice newCommandQueue];
 		}
+//Melder_casual (U"start ", Melder_stopwatch ());
 		MPSMatrixMultiplication *matrixMultiplication = [[MPSMatrixMultiplication alloc]
 			initWithDevice: gpuDevice
 			resultRows: integer_to_uinteger (target.nrow)
@@ -487,7 +489,7 @@ void MATVUmul_forceMetal_ (MATVU const& target, constMATVU const& x, constMATVU
 		];
 		Melder_assert (matrixMultiplication != nil);
 
-		uinteger xRowStrideInBytes = [MPSMatrixDescriptor rowBytesForColumns: uinteger (x.ncol)  dataType:MPSDataTypeFloat32];
+		uinteger xRowStrideInBytes = [MPSMatrixDescriptor rowBytesForColumns: uinteger (x.ncol)  dataType: MPSDataTypeFloat32];
 		uinteger xRowStrideInFloats = xRowStrideInBytes / sizeof (float);
 		autovector <float> x32 = newvectorzero <float> (integer (uinteger (x.nrow) * xRowStrideInFloats));
 		for (integer irow = 1; irow <= x.nrow; irow ++) {
@@ -496,7 +498,7 @@ void MATVUmul_forceMetal_ (MATVU const& target, constMATVU const& x, constMATVU
 				*prow ++ = float (x [irow] [icol]);
 		}
 
-		uinteger yRowStrideInBytes = [MPSMatrixDescriptor rowBytesForColumns: uinteger (y.ncol)  dataType:MPSDataTypeFloat32];
+		uinteger yRowStrideInBytes = [MPSMatrixDescriptor rowBytesForColumns: uinteger (y.ncol)  dataType: MPSDataTypeFloat32];
 		uinteger yRowStrideInFloats = yRowStrideInBytes / sizeof (float);
 		autovector <float> y32 = newvectorzero <float> (integer (uinteger (y.nrow) * yRowStrideInFloats));
 		for (integer irow = 1; irow <= y.nrow; irow ++) {
@@ -505,21 +507,22 @@ void MATVUmul_forceMetal_ (MATVU const& target, constMATVU const& x, constMATVU
 				*prow ++ = float (y [irow] [icol]);
 		}
 
-		uinteger targetRowStrideInBytes = [MPSMatrixDescriptor rowBytesForColumns: uinteger (y.ncol)  dataType:MPSDataTypeFloat32];
+		uinteger targetRowStrideInBytes = [MPSMatrixDescriptor rowBytesForColumns: uinteger (y.ncol)  dataType: MPSDataTypeFloat32];
 		uinteger targetRowStrideInFloats = targetRowStrideInBytes / sizeof (float);
 		autovector <float> target32 = newvectorzero <float> (integer (uinteger (target.nrow) * targetRowStrideInFloats));
 
-		uinteger x32length = (uinteger (x.nrow) * xRowStrideInBytes);
-		id <MTLBuffer> bufferX = [gpuDevice newBufferWithBytes: & x32 [1]  length: x32length  options: MTLResourceStorageModeShared];
+		uinteger x32length = uinteger (x.nrow) * xRowStrideInBytes;
+		id <MTLBuffer> bufferX = [gpuDevice newBufferWithBytes: & x32 [1]  length: x32length  options: MTLResourceStorageModeManaged];
 		Melder_assert (bufferX != nil);
 
-		uinteger y32length = (uinteger (y.nrow) * yRowStrideInBytes);
-		id <MTLBuffer> bufferY = [gpuDevice newBufferWithBytes: & y32 [1]  length: y32length  options: MTLResourceStorageModeShared];
+		uinteger y32length = uinteger (y.nrow) * yRowStrideInBytes;
+		id <MTLBuffer> bufferY = [gpuDevice newBufferWithBytes: & y32 [1]  length: y32length  options: MTLResourceStorageModeManaged];
 		Melder_assert (bufferY != nil);
 
-		uinteger target32length = (uinteger (target.nrow) * targetRowStrideInBytes);
+		uinteger target32length = uinteger (target.nrow) * targetRowStrideInBytes;
 		id <MTLBuffer> bufferTarget = [gpuDevice newBufferWithBytes: & target32 [1]  length: target32length  options: MTLResourceStorageModeShared];
 		Melder_assert (bufferTarget != nil);
+//Melder_casual (U"to GPU ", Melder_stopwatch ());
 
 		MPSMatrixDescriptor *descriptorX =
 			[MPSMatrixDescriptor matrixDescriptorWithRows: uinteger (x.nrow)
@@ -551,7 +554,28 @@ void MATVUmul_forceMetal_ (MATVU const& target, constMATVU const& x, constMATVU
 			rightMatrix: mpsY
 			resultMatrix: mpsTarget];
 		[commandBuffer commit];
+		/*
+			For testing.
+		*/
+		constexpr integer numberOfTimes = 0;
+		id <MTLCommandBuffer> commandBuffers [numberOfTimes];
+		for (integer itime = 0; itime < numberOfTimes; itime ++) {
+			commandBuffers [itime] = [gpuQueue commandBuffer];
+			[matrixMultiplication encodeToCommandBuffer: commandBuffers [itime]
+				leftMatrix: mpsX
+				rightMatrix: mpsTarget
+				resultMatrix: mpsY];
+			[matrixMultiplication encodeToCommandBuffer: commandBuffers [itime]
+				leftMatrix: mpsX
+				rightMatrix: mpsY
+				resultMatrix: mpsTarget];
+			[commandBuffers [itime] commit];
+		}
 		[commandBuffer waitUntilCompleted];
+		for (integer itime = 0; itime < numberOfTimes; itime ++) {
+			[commandBuffers [itime] waitUntilCompleted];
+		}
+//Melder_casual (U"in GPU ", Melder_stopwatch ());
 		NSError *error = [commandBuffer error];
 		if (error) {
 			/*
@@ -572,14 +596,15 @@ void MATVUmul_forceMetal_ (MATVU const& target, constMATVU const& x, constMATVU
 				localizedDescription.get(), localizedFailureReason.get(), localizedRecoverySuggestion.get());
 		}
 		[error release];
-		float *rawPointer = (float *) [bufferTarget contents];
+		const float * const rawPointer = (const float *) [bufferTarget contents];
 		for (integer irow = 1; irow <= target.nrow; irow ++) {
-			float *prow = rawPointer + uinteger (irow - 1) * targetRowStrideInFloats;
+			const float * prow = rawPointer + uinteger (irow - 1) * targetRowStrideInFloats;
 			for (integer icol = 1; icol <= target.ncol; icol ++) {
-				double value = double (*prow ++);
+				const double value = double (*prow ++);
 				target [irow] [icol] = value;
 			}
 		}
+//Melder_casual (U"from GPU ", Melder_stopwatch ());
 		[bufferX release];
 		[bufferY release];
 		[bufferTarget release];
@@ -591,6 +616,33 @@ void MATVUmul_forceMetal_ (MATVU const& target, constMATVU const& x, constMATVU
 		//[descriptorY release];
 		//[descriptorTarget release];
 		[pool release];   // this releases `commandBuffer`
+		/*
+			Check the result.
+		*/
+		//return;
+		const integer numberOfChecks = Melder_iround (pow (target.nrow * target.ncol, 0.33333));
+		integer numberOfUnexpectedZeroes = 0;
+		for (integer icheck = 1; icheck <= numberOfChecks; icheck ++) {
+			const integer rowNumber = NUMrandomInteger (1, target.nrow);
+			const integer columnNumber = NUMrandomInteger (1, target.ncol);
+			const double targetValue = target [rowNumber] [columnNumber];
+			double checkedValue = 0.0;
+			for (integer i = 1; i <= x.ncol; i ++)
+				checkedValue += x [rowNumber] [i] * y [i] [columnNumber];
+			if (checkedValue != 0.0) {
+				//Melder_require (targetValue != 0.0,
+				//	U"GPU matrix multiplication incorrect: unexpected zero at row ", rowNumber, U" and column ", columnNumber, U": value should be ", checkedValue, U".");
+				if (targetValue == 0.0) {
+					numberOfUnexpectedZeroes ++;
+				} else {
+					const double relativeError = fabs (checkedValue / targetValue - 1.0);
+					Melder_require (relativeError < 0.1,
+						U"GPU matrix multiplication incorrect: unexpected imprecision of ", relativeError, U".");
+				}
+			}
+		}
+		Melder_require (numberOfUnexpectedZeroes == 0,
+			U"GPU matrix multiplication incorrect: found ", numberOfUnexpectedZeroes, U" unexpected zeroes.");
 		return;
 	}
 #else


=====================================
sys/Formula.cpp
=====================================
@@ -5126,7 +5126,7 @@ static void do_MATmul_fast () {
 		autoMAT result = newMATmul_fast (x->numericMatrix, y->numericMatrix);
 		pushNumericMatrix (result.move());
 	} else {
-		Melder_throw (U"The function \"mul##\" requires two matrices, not ", x->whichText(), U" and ", y->whichText(), U".");
+		Melder_throw (U"The function \"mul_fast##\" requires two matrices, not ", x->whichText(), U" and ", y->whichText(), U".");
 	}
 }
 static void do_MATmul_tn () {


=====================================
sys/Graphics_linesAndAreas.cpp
=====================================
@@ -752,7 +752,7 @@ void structGraphics :: v_fillRoundedRectangle (double x1DC, double x2DC, double
 #define wdy(y)  ((y) * my scaleY + my deltaY)
 
 void Graphics_polyline (Graphics me, integer numberOfPoints, double *xWC, double *yWC) {   // base 0
-	if (numberOfPoints == 0) return;
+	if (numberOfPoints < 2) return;
 	double *xyDC;
 	try {
 		xyDC = Melder_malloc (double, 2 * numberOfPoints);
@@ -778,7 +778,7 @@ void Graphics_polyline (Graphics me, integer numberOfPoints, double *xWC, double
 }
 
 void Graphics_polyline_closed (Graphics me, integer numberOfPoints, double *xWC, double *yWC) {   // base 0
-	if (numberOfPoints == 0) return;
+	if (numberOfPoints < 1) return;
 	double *xyDC;
 	try {
 		xyDC = Melder_malloc (double, 2 * numberOfPoints);
@@ -815,6 +815,7 @@ void Graphics_line (Graphics me, double x1WC, double y1WC, double x2WC, double y
 }
 
 void Graphics_fillArea (Graphics me, integer numberOfPoints, double const *xWC, double const *yWC) {
+	if (numberOfPoints < 3) return;
 	double *xyDC;
 	try {
 		xyDC = Melder_malloc (double, 2 * numberOfPoints);
@@ -939,7 +940,7 @@ integer Graphics_function_ (Graphics me, const TYPE yWC [], integer stride, inte
 
 void Graphics_function (Graphics me, const double yWC [], integer ix1, integer ix2, double x1WC, double x2WC) {
 	integer n = Graphics_function_ <double> (me, yWC, 1, ix1, ix2, x1WC, x2WC);
-	if (my recording) { op (FUNCTION, 3 + n); put (n); put (x1WC); put (x2WC); mput (n, & yWC [ix1]) }
+	if (my recording && n >= 2) { op (FUNCTION, 3 + n); put (n); put (x1WC); put (x2WC); mput (n, & yWC [ix1]) }
 }
 
 void Graphics_function16 (Graphics me, const int16 yWC [], int stride, integer ix1, integer ix2, double x1WC, double x2WC) {


=====================================
sys/Graphics_record.cpp
=====================================
@@ -21,6 +21,7 @@
 #define RECORDING_HEADER_LENGTH 2
 
 double * _Graphics_check (Graphics me, integer number) {
+	Melder_assert (number >= 0);
 	static bool messageHasAlreadyBeenShownOnce = false;
 	double *result = nullptr;
 	double *record = my record;
@@ -39,7 +40,8 @@ double * _Graphics_check (Graphics me, integer number) {
 			}
 			return nullptr;
 		}
-		my record = record; my nrecord = nrecord;
+		my record = record;
+		my nrecord = nrecord;
 	}
 	if (nrecord < my irecord + RECORDING_HEADER_LENGTH + number) {
 		while (nrecord < my irecord + RECORDING_HEADER_LENGTH + number) nrecord *= 2;
@@ -55,7 +57,8 @@ double * _Graphics_check (Graphics me, integer number) {
 			}
 			return nullptr;
 		}
-		my record = record; my nrecord = nrecord;
+		my record = record;
+		my nrecord = nrecord;
 	}
 	result = my record + my irecord;
 	my irecord += number + RECORDING_HEADER_LENGTH;


=====================================
sys/praat_objectMenus.cpp
=====================================
@@ -656,9 +656,6 @@ void praat_addMenus (GuiWindow window) {
 			praat_addMenuCommand (U"Objects", U"Window", U"Close   ", nullptr, 'W' | praat_NO_API, PRAAT_close);
 		#endif
 	#endif
-	#ifdef UNIX
-		praat_addMenuCommand (U"Objects", U"Praat", itemTitle_about.string, nullptr, praat_UNHIDABLE, WINDOW_About);
-	#endif
 	praat_addMenuCommand (U"Objects", U"Praat", U"-- script --", nullptr, 0, nullptr);
 	praat_addMenuCommand (U"Objects", U"Praat", U"New Praat script", nullptr, praat_NO_API, WINDOW_praat_newScript);
 	praat_addMenuCommand (U"Objects", U"Praat", U"Open Praat script...", nullptr, praat_NO_API, WINDOW_praat_openScript);
@@ -715,10 +712,8 @@ void praat_addMenus2 () {
 	praat_addMenuCommand (U"Objects", U"ApplicationHelp",
 		Melder_cat (U"Search ", praatP.title.get(), U" manual..."),
 		nullptr, 'M' | praat_NO_API, HELP_SearchManual);
-	#ifdef _WIN32
-		praat_addMenuCommand (U"Objects", U"Help", U"-- about --", nullptr, 0, nullptr);
-		praat_addMenuCommand (U"Objects", U"Help", itemTitle_about.string, nullptr, praat_UNHIDABLE, WINDOW_About);
-	#endif
+	praat_addMenuCommand (U"Objects", U"ApplicationHelp", U"-- about --", nullptr, 0, nullptr);
+	praat_addMenuCommand (U"Objects", U"ApplicationHelp", itemTitle_about.string, nullptr, praat_UNHIDABLE, WINDOW_About);
 
 	#if defined (macintosh) || defined (_WIN32)
 		Gui_setOpenDocumentCallback (cb_openDocument);


=====================================
sys/praat_version.h
=====================================
@@ -1,5 +1,5 @@
-#define PRAAT_VERSION_STR 6.0.47
-#define PRAAT_VERSION_NUM 6047
+#define PRAAT_VERSION_STR 6.0.48
+#define PRAAT_VERSION_NUM 6048
 #define PRAAT_YEAR 2019
 #define PRAAT_MONTH February
-#define PRAAT_DAY 8
+#define PRAAT_DAY 17



View it on GitLab: https://salsa.debian.org/med-team/praat/compare/a5e1d306532ceb48fbc377ca0c717ec57bbf5bd6...f1500bb1a4da8e593215adea7e3c758a1c8893bd

-- 
View it on GitLab: https://salsa.debian.org/med-team/praat/compare/a5e1d306532ceb48fbc377ca0c717ec57bbf5bd6...f1500bb1a4da8e593215adea7e3c758a1c8893bd
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190221/873dc15a/attachment-0001.html>


More information about the debian-med-commit mailing list