From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Immanuel Litzroth Newsgroups: gmane.emacs.devel Subject: Re: Adding a generic mathematical library Date: Sun, 28 Jul 2024 15:34:28 +0200 Message-ID: References: <87o76ik616.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000e594f1061e4ecf23" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20738"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Shouran Ma , Emanuel Berg , emacs-devel@gnu.org, Sergey Kostyaev , Philip Kaludercic To: Christopher Dimech Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jul 28 15:35:58 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sY445-0005GJ-Hi for ged-emacs-devel@m.gmane-mx.org; Sun, 28 Jul 2024 15:35:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sY43O-00024F-KX; Sun, 28 Jul 2024 09:35:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sY43L-000244-Ji for emacs-devel@gnu.org; Sun, 28 Jul 2024 09:35:11 -0400 Original-Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sY43H-0002Dj-Pn for emacs-devel@gnu.org; Sun, 28 Jul 2024 09:35:10 -0400 Original-Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-52f00ad303aso4130161e87.2 for ; Sun, 28 Jul 2024 06:35:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722173705; x=1722778505; darn=gnu.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=4Lr7K7zuhpDw+Q4LK7gnnC3iz4uCccB4Lfca60O8x88=; b=c5oTGhdHe2NCfdPuvERr4Co7Lg7YihuwBe8ZEJmdxP1efJ3luxgIkXgsLfZfahXwGK z/2VH6gC5H+BNUPhbSPRNUQznL+kR7JxJ+ik7EoHQ97/48kIE02wR6xXlUNyuXM2Gr/J cSTEhV8xA63cuUdA/mANWjdTPRt3Slo0N9Ve7lkfc9hGInTKar2TgK4zp7IvZlUV7pfD smv7w6VIlJKvPkl2lpAfsn44x4rlojiTuv6mkx75G1usQZ+qtMNTZxx9qSpcFSPpnROO KausYD5t2NR91NoqXbPfG5XfXAmJ5YKRCLqraNUe36V/bIv1JE9b24IU37VGOE7zMGHV uZ/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722173705; x=1722778505; 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=4Lr7K7zuhpDw+Q4LK7gnnC3iz4uCccB4Lfca60O8x88=; b=suP+YrtYqv0yI5j+PvAlJDEhDJU5ug8wt+bDqu+JiEubbqXai4+2VNS8gCKqJysImd Low0lQ9wBgsaAjcBlrDVrmUY+chrnS9XLxGUWLOVQw0lp+6jq7NOV2S+IUMhVelB5tnv 5bX3TIywfq8rVEJ2l/z2KvoXnmXwiZw7imwdRaSibD7J/CthYfSCQVSsu/wnDjQimU1x repxfy08yEwp1Y1DbEGx7g5nyU8ZAv833L3FKHKAEnI0yarfN4PG0ESGEyPKQrRpSNSX P+YLMsrkGFtVMVNtlHqPzk49af59VhoIH/LPzovCX0nuHuv6I1qzjmrOF5uoWGbRL+R9 F8aA== X-Forwarded-Encrypted: i=1; AJvYcCVSXqBmOFgzb8j71pf/8rHjo7ylybOltmtYsOOTs/09zN6JPxN5YkqaZjo0hkfS3zuveqZXv/vzT5cZAUc4O2CjZ+n8 X-Gm-Message-State: AOJu0YxmKhiELWIZN13dq+cLMUlrjNAxqC1Jxbhj0mEWrg5mznvH8EpU v0nulLLKDknLZ7lblcUIvoWEOFLCACkVZZONzR+dgdfwfktic7CBhdlxqpG77dk0ZVqG/N/Tuvg jsTa8KF84TmJTG1IZaLNGQ2JOeQ== X-Google-Smtp-Source: AGHT+IENhKZPVuiIOYL8zlYQRWbt1qILDVCiJyEIiHyUzdnD8p+ic02xfvmpzFdhsb4l5LrYWXXbqROxvJASpOHNtZI= X-Received: by 2002:a05:6512:250d:b0:52d:9ad6:f43f with SMTP id 2adb3069b0e04-5309b259b14mr3938779e87.5.1722173704474; Sun, 28 Jul 2024 06:35:04 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=immanuel.litzroth@gmail.com; helo=mail-lf1-x129.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322161 Archived-At: --000000000000e594f1061e4ecf23 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > Indexing in an everyday task ... Like writing? Immanuel On Sat, Jul 27, 2024 at 9:40=E2=80=AFPM Christopher Dimech = wrote: > > > Sent: Sunday, July 28, 2024 at 7:07 AM > > From: "Shouran Ma" > > To: "Emanuel Berg" > > Cc: emacs-devel@gnu.org, "Sergey Kostyaev" , > "Philip Kaludercic" > > Subject: Re: Adding a generic mathematical library > > > > > > > Sent: Saturday, July 27, 2024 at 16:57 +0200 > > > From: "Shouran Ma" > > > > > > However, WE DON'T EVEN HAVE A UNIFIED WAY TO REPRESENTING A VECTOR. > > > > I need to elaborate this statement, otherwise it cause confusion to > > others. > > > > Elisp provides "List" and "Vector" as an array of numbers: > > > https://www.gnu.org/software/emacs/manual/html_node/elisp/Sequences-Array= s-Vectors.html > > > > To express an array of numbers, a developer would either use two of the= m > > - (setq x '(1 2 3 4)) ; (type-of x) =3D> cons > > - (setq x [1 2 3 4]) ; (type-of x) =3D> vector > > > > "cons" (or "list") is the first thing that everybody would choose, for > > example, in Sergey's elisa: > > https://github.com/s-kostyaev/elisa/blob/main/elisa.el > > In the function "elisa--distances", Sergey puts "head" and "(car tail)" > > as arguments to "elisa-cosine-distance", this means Sergey uses > > cons/list to organize array of numbers. > > > > However, Elisp also has "array" types: > > https://www.gnu.org/software/emacs/manual/html_node/elisp/Arrays.html > > > An array object has slots that hold a number of other Lisp objects, > > > called the elements of the array. Any element of an array MAY BE > > > ACCESSED IN CONSTANT TIME. In contrast, the time to access an element > > > of a list is proportional to the position of that element in the list= . > > > > cons/list is something like "linked list" which is not accessed in cons= t > > time, but vector support this, e.g. it takes more time to access the > > last element if we use cons/list, but less time if use vector. > > > > However, Elisp provides too few functions on operating the vector type, > > for example, to slice a vector like the way in python: array[2:4]. > > > > So my saying "don't even have a unified way to representing a vector", = I > > mean, to organize/represent a MATHEMATICAL vector > > - I would prefer to choose the object that support const time access, > > i.e. the BUILTIN vector type, over the cons/list. > > - However, the BUILTIN vector type supports quite a few functions, whic= h > > forces me to change my mind to organize/represent the MATHEMATICAL > > vectors by cons/list. > > > > This is the dilemma during developing my own math libraries. > > > > Besides, in the Calc subroutine, the MATHEMATICAL vectors are > > represented by cons/list in this way > > (vec 3 5 2 1 0) ; not (3 5 2 1 0) or [3 5 2 1 0] > > i.e. a symbol "vec" is placed at the beginning of the list, in order to > > simplify the predication. But this leads to the indexing problem, that > > elements are indexed since 1, not 0. Such an indexing scheme would caus= e > > a nightmare to the developer who want to use our math subroutine to do > > further development. > > An indexing task should never be a problem to the seasoned developer. > If they find it a nightmare, there is something missing with the develope= r. > > Indexing in an everyday task in scientific programming. One just has to > focus > and think about what one is doing a little bit. > > > In summary, if the builtin vector type is preferred way to represent th= e > > MATHEMATICAL vector, we should first of all complete the fundamental > > vector operations, like vector slicing etc. And of course, we should > > take a look at how sbcl > > https://git.code.sf.net/p/sbcl/sbcl > > organize their vector and their vector functions. > > > > From my side, I don't want to touch the vector things so far, but inste= ad > > the rational number (the bullet 2 & 3 in my previous mail). > > > > Finally, > > > Sent: Saturday, July 27, 2024 at 17:49 +0200 > > > From: "Emanuel Berg" > > > > > > However it used to be even worse, when we didn't even have clocks! > > > > If the "clock" you said is the clock to measure how long a function > > runs, we have, it is "benchmark-run". > > > > > > -- > > Best Regards, > > Shouran Ma > > > > > > --=20 -- A man must either resolve to point out nothing new or to become a slave to defend it. -- Sir Isaac Newton --000000000000e594f1061e4ecf23 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> Indexing in an everyday task ...
Like writing= ?
Immanuel

On Sat, Jul 27, 2024 at 9:40=E2=80=AFPM Christoph= er Dimech <dimech@gmx.com> wrot= e:

> Sent: Sunday, July 28, 2024 at 7:07 AM
> From: "Shouran Ma" <shouran.ma@gmail.com>
> To: "Emanuel Berg" <incal@dataswamp.org>
> Cc: emacs-dev= el@gnu.org, "Sergey Kostyaev" <sskostyaev@gmail.com>, "Philip K= aludercic" <philipk@posteo.net>
> Subject: Re: Adding a generic mathematical library
>
>
> > Sent: Saturday, July 27, 2024 at 16:57 +0200
> > From: "Shouran Ma" <shouran.ma@gmail.com>
> >
> > However, WE DON'T EVEN HAVE A UNIFIED WAY TO REPRESENTING A V= ECTOR.
>
> I need to elaborate this statement, otherwise it cause confusion to > others.
>
> Elisp provides "List" and "Vector" as an array of = numbers:
> https://= www.gnu.org/software/emacs/manual/html_node/elisp/Sequences-Arrays-Vectors.= html
>
> To express an array of numbers, a developer would either use two of th= em
> - (setq x '(1 2 3 4))=C2=A0 ; (type-of x) =3D> cons
> - (setq x [1 2 3 4])=C2=A0 =C2=A0; (type-of x) =3D> vector
>
> "cons" (or "list") is the first thing that everybo= dy would choose, for
> example, in Sergey's elisa:
> https://github.com/s-kostyaev/elisa/blob/= main/elisa.el
> In the function "elisa--distances", Sergey puts "head&q= uot; and "(car tail)"
> as arguments to "elisa-cosine-distance", this means Sergey u= ses
> cons/list to organize array of numbers.
>
> However, Elisp also has "array" types:
> https://www.gnu.org/softwa= re/emacs/manual/html_node/elisp/Arrays.html
> > An array object has slots that hold a number of other Lisp object= s,
> > called the elements of the array. Any element of an array MAY BE<= br> > > ACCESSED IN CONSTANT TIME. In contrast, the time to access an ele= ment
> > of a list is proportional to the position of that element in the = list.
>
> cons/list is something like "linked list" which is not acces= sed in const
> time, but vector support this, e.g. it takes more time to access the > last element if we use cons/list, but less time if use vector.
>
> However, Elisp provides too few functions on operating the vector type= ,
> for example, to slice a vector like the way in python: array[2:4].
>
> So my saying "don't even have a unified way to representing a= vector", I
> mean, to organize/represent a MATHEMATICAL vector
> - I would prefer to choose the object that support const time access,<= br> > i.e. the BUILTIN vector type, over the cons/list.
> - However, the BUILTIN vector type supports quite a few functions, whi= ch
> forces me to change my mind to organize/represent the MATHEMATICAL
> vectors by cons/list.
>
> This is the dilemma during developing my own math libraries.
>
> Besides, in the Calc subroutine, the MATHEMATICAL vectors are
> represented by cons/list in this way
> (vec 3 5 2 1 0)=C2=A0 ; not (3 5 2 1 0) or [3 5 2 1 0]
> i.e. a symbol "vec" is placed at the beginning of the list, = in order to
> simplify the predication. But this leads to the indexing problem, that=
> elements are indexed since 1, not 0. Such an indexing scheme would cau= se
> a nightmare to the developer who want to use our math subroutine to do=
> further development.

An indexing task should never be a problem to the seasoned developer.
If they find it a nightmare, there is something missing with the developer.=

Indexing in an everyday task in scientific programming.=C2=A0 One just has = to focus
and think about what one is doing a little bit.

> In summary, if the builtin vector type is preferred way to represent t= he
> MATHEMATICAL vector, we should first of all complete the fundamental > vector operations, like vector slicing etc. And of course, we should > take a look at how sbcl
> https://git.code.sf.net/p/sbcl/sbcl
> organize their vector and their vector functions.
>
> From my side, I don't want to touch the vector things so far, but = instead
> the rational number (the bullet 2 & 3 in my previous mail).
>
> Finally,
> > Sent: Saturday, July 27, 2024 at 17:49 +0200
> > From: "Emanuel Berg" <incal@dataswamp.org>
> >
> > However it used to be even worse, when we didn't even have cl= ocks!
>
> If the "clock" you said is the clock to measure how long a f= unction
> runs, we have, it is "benchmark-run".
>
>
> --
> Best Regards,
> Shouran Ma
>
>



--
-- A man must either resolve to point out nothing new or to = become a slave to defend it. -- Sir Isaac Newton
--000000000000e594f1061e4ecf23--