void 
Pointillize(QImage * img, QImage * canvas, int radius, double strength)
/// 
/// Changes a given image to a pointillistic painting style.
/// Uses poisson disks for point placement. 
/// Colors are chosen which are isoluminant and approximate the average local color.
///
/// @param img
///  The reference image.
///
/// @param canvas
///  The image to store the result of the filter.
///
/// @param radius
///  The radius of the points to be painted.
///
/// @param strength
///  The strength of the pointillistic filter, where 1.0 is very strong and 0.0 is very weak.
///
/// @return
///  Nothing.
///
{
	*canvas = img->copy();
	if( strength > 0.0 ) 
	{
		BaseLayer( img, canvas, radius*3, strength );
		MainLayer( img, canvas, radius, strength );
		EdgeLayer( img, canvas, radius, 0.2, strength);
	}
}
MultiLayerPerceptron::MultiLayerPerceptron(int inputDim0, int outputDim0, int hiddenDim0, std::shared_ptr<arma::mat> trainingX0,
        std::shared_ptr<arma::mat> trainingY0, TrainingPara trainingPara0) {


    inputDim = inputDim0;
    hiddenDim = hiddenDim0;
    outputDim = outputDim0;
    numLayers = 2;
    trainingX = trainingX0;
    trainingY = trainingY0;
    numInstance = trainingX->n_rows;
    trainingPara = trainingPara0;

    layers.push_back(BaseLayer(inputDim,hiddenDim,BaseLayer::sigmoid));
    layers.push_back(BaseLayer(hiddenDim,outputDim,BaseLayer::softmax));
//   layers[0].W.print("layer 0  W");
//   layers[0].B.print("layer 0  B");
//   layers[1].W.print("layer 1  W");
//   layers[1].B.print("layer 1  B");
}