From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id 1902C3858C33 for ; Tue, 21 Nov 2023 08:48:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1902C3858C33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1902C3858C33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::52d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700556508; cv=none; b=mWOjpL79MCsPbJDEWZmSfzDO5rTleBXMBsALBeXlMOZKVQ0wfE4LI8gPVCKxvIRrwnwkfx+dzu/K7dSJptL8hz3pU6woibP4te0UD7r75LY6A+kl6cEyNDRWpXUZZUB+AbLRs2nDKnOY1QhPl6CDCJ1mcsmPfC+4QRxMXABcyWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700556508; c=relaxed/simple; bh=m57hhN+GuGihEnefcIkcWZWbUw6RSlt61Urb1U2kths=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=JUPX0TQ0K+n2L3V2siKaorjmxxT7aMVeT+AN1dBuXwm/MCdCA04rtGaCu6Cb5xiR5qF8+9pwWYcGlTAo9xZws9JvfBorS9vxWu8xdltx1OsNDlTvObwBGu17YxaXw3ApHdC/4Bo5khP7pgs9At34JoT8U2a0Nrt94ryoShMZuTc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5441ba3e53cso7207642a12.1 for ; Tue, 21 Nov 2023 00:48:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700556505; x=1701161305; darn=sourceware.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=25vIPRtPozxe3pZ8CVWtT0rmelmvh7p7RJT7iR3oOQg=; b=ZgtymzUSNehZ1e7yXqEnJtKTx1lV+RgtMhNCvWeM2nd327hEUk7VMEw2dWgBzFF731 LrJJAspT/zCb8Ej3yJHWLckXdBrhy2RC1MRKm11OwRE26JVwm/XS/VCz/cn7Ely5smlu QYLhr0IXb2pvGQNPfedx0gwH+GFygDpht7xVpRRbAML7ufJMmO95TfF9u5+yy3yjg6Ef TYvqsfj33bstcqSyScBxujEJeHb+LR9YbC6bEqqGJbpL31tsFYQTAc48pBh/tWPFHh5N YYgSAI1d3xlDiX2MXcPYwz4ycZICsc+nu40yXvVGU4MoGEvXgKdy+u2Zeoyrb7oWlPoH UPrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700556505; x=1701161305; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=25vIPRtPozxe3pZ8CVWtT0rmelmvh7p7RJT7iR3oOQg=; b=kCXIRkSFBknGm+aS2vmx8z029jzZW95A55mSV+vy0LTn7d6Muh0mC68vz1ieBmSRPM OuB3+xBcH5vSq6nu3wj32kdmBnZtrMT7ZBzP9XE0XbflUSXz7ZthrRXYu97OD8m4D8Jm G+z8Q3auscpBrAqLOjBvUBAc3IKS5QH72oQyZtSXVPWt8yK1NezOqIpKHAVsNNpv+1GW SSQVG3M9RK+xoKDrynf15U8+fXOrNSBaKN5mrXCyJnyliZnlEurmD/4qRVIRlgeSfctm z5EkjYvu3j9GDqVQf4aAOPSkVpGs00ey11JZStGIUT86TCTn/quDwMBYZmxIxm0lInL0 y9VQ== X-Gm-Message-State: AOJu0YzlOKgRCKAbv7drodM5duGamErQALxYH2Oze9FkR7goY+12a2tp J2fzNMLJcGomvE1VLeUhxxmeFVM5n389DVOJ8nz7bBkM3ZTu69jB X-Google-Smtp-Source: AGHT+IEQOvxUdYwn2OymF7CuJeqv+qB3yMwU4j/d3XiddtOxaQnqEsTz3oAI5VK0cXOd7F8iq5efCSGotYejqdhUGf4= X-Received: by 2002:aa7:c686:0:b0:547:540c:983 with SMTP id n6-20020aa7c686000000b00547540c0983mr1272617edq.30.1700556504566; Tue, 21 Nov 2023 00:48:24 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Damien Mattei Date: Tue, 21 Nov 2023 09:48:13 +0100 Message-ID: Subject: Re: n arity with method To: Per Bothner Cc: kawa@sourceware.org Content-Type: multipart/alternative; boundary="000000000000600da3060aa5aaf9" X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000600da3060aa5aaf9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable and i just realize there is even more parenthesis { } in the above expression that the infix operator precedence analyser does not need, we can rewrite the expression: {M_i_o[j {i + 1}] <- M_i_o[j {i + 1}] - {(- =CE=B7) * z_input[i] * =E1=83=9Bz=E2=B3=86=E1=83=9Bz=CC=83(z_output[j] z=CC=83_output[j]) * =E1=90= =81_i_o[j]}} {M_i_o[j {i + 1}] <- M_i_o[j {i + 1}] - (- =CE=B7) * z_input[i] * =E1=83=9Bz=E2=B3=86=E1=83=9Bz=CC=83(z_output[j] z=CC=83_output[j]) * =E1=90= =81_i_o[j]} which is : {M_i_o[j {i + 1}] <- M_i_o[j {i + 1}] + =CE=B7 * z_input[i] * =E1=83=9Bz=E2=B3=86=E1=83=9Bz=CC=83(z_output[j] z=CC=83_output[j]) * =E1=90= =81_i_o[j]} and my infix operator precedence deal well with * and + or - precedences and the computation still give the good result: ################## NOT ################## *init* : nc=3D#(1 2 1) z=3D#(#(0) #(0 0) #(0)) z=CC=83=3D#(#(0) #(0 0) #(0)) M=3D#(matrix@5942ee04 matrix@5e76a2bb) =E1=90=81=3D#(#(0) #(0 0) #(0)) nbiter=3D5000 exo_retropropagationNhidden_layers_matrix_v2_by_vectors4kawa.scm:131:2: warning - no known slot 'apprentissage' in java.lang.Object 0 1000 2000 3000 4000 exo_retropropagationNhidden_layers_matrix_v2_by_vectors4kawa.scm:132:2: warning - no known slot 'test' in java.lang.Object Test des exemples : #(1) --> #(0.006614618861519643) : on attendait #(0) #(0) --> #(0.9929063781049513) : on attendait #(1) Error on examples=3D1.1928342099764103E-4 ;-) so many computation in deep learning just to compute NOT boolean,what a '50 light bulb computer was doing faster..... :-) Damien On Mon, Nov 20, 2023 at 2:51=E2=80=AFPM Damien Mattei wrote: > yes ,indexing is overloaded ,using same procedure for vector,string,hash > table ,this take times but the slower is the infix precedence operator > algorithm that is called each time even if the formula in a loop never > change,example in: > (for-each-in (j (in-range len_layer_output)) ; line > (for-each-in (i (in-range len_layer_input)) ; column , parcours les > colonnes de la ligne sauf le bias > {M_i_o[j {i + 1}] <- M_i_o[j {i + 1}] - {(- =CE=B7) * z_input[i]= * > =E1=83=9Bz=E2=B3=86=E1=83=9Bz=CC=83(z_output[j] z=CC=83_output[j]) * =E1= =90=81_i_o[j]}}) > > ; and update the bias > {M_i_o[j 0] <- M_i_o[j 0] - {(- =CE=B7) * 1.0 * =E1=83=9Bz=E2=B3= =86=E1=83=9Bz=CC=83(z_output[j] > z=CC=83_output[j]) * =E1=90=81_i_o[j]}})) > > {M_i_o[j {i + 1}] <- M_i_o[j {i + 1}] - {(- =CE=B7) * z_input[i] * > =E1=83=9Bz=E2=B3=86=E1=83=9Bz=CC=83(z_output[j] z=CC=83_output[j]) * =E1= =90=81_i_o[j]}} is expanded at each 'for' > loop iteration in: > > ($nfx$ > (bracket-apply M_i_o j (+ i 1)) > <- > (bracket-apply M_i_o j (+ i 1)) > - > (* > (- =CE=B7) > (bracket-apply z_input i) > (=E1=83=9Bz=E2=B3=86=E1=83=9Bz=CC=83 (bracket-apply z_output j) (brack= et-apply z=CC=83_output j)) > (bracket-apply =E1=90=81_i_o j))) > > with evaluation of $nfx$ (see code in : > https://github.com/damien-mattei/Scheme-PLUS-for-Kawa/blob/main/scheme-in= fix.scm) > and many bracket-apply ( > https://github.com/damien-mattei/Scheme-PLUS-for-Kawa/blob/main/apply-squ= are-brackets.scm > ) even if the expression never change, the numeric computation change, but > not the symbolic evaluation of operator precedence. > > This could be precomputed by Scheme+ before compilation by Kawa or any > Scheme that use Scheme+ but this is a big work i have not begin. > > Damien > > On Sun, Nov 19, 2023 at 6:50=E2=80=AFPM Per Bothner wro= te: > >> On 11/18/23 23:23, Damien Mattei via Kawa wrote: >> > when comparing speed on the first part of my program written in Scheme+ >> it >> > run in 15" with Kawa and 7" in Racket. >> >> It is likely you can speed up Kawa quite a bit by fixing a few slow spot= s. >> Specifically, anytime you do run-time reflection (or worse: eval/load) >> you're >> going to lose a lot of performance. If you can replace generic arithmetic >> or vector/list indexing with type-specific arithmetic/indexing that can >> also make a big difference. List processing (especially if you call cons >> a lot) is always going to be relatively expensive. >> >> Profiling is probably the thing to try. I do little-to-no Java programmi= ng >> these days, so I can't be any more specific with help. >> -- >> --Per Bothner >> per@bothner.com http://per.bothner.com/ >> > --000000000000600da3060aa5aaf9--