Re: [Rd] F77_CALL(dgetrs) C++ call in R-devel

2022-12-21 Thread Lars Relund
Thanks I got it to work!

I will try to migrate to (Rcpp)Armadillo asap.

Lars


Den tir. 20. dec. 2022 kl. 14.09 skrev Dirk Eddelbuettel :

>
> On 20 December 2022 at 12:33, Lars Relund wrote:
> | In my package, I have the method:
> |
> | /** Solve equations transpose(P)w = r. */
> | int LASolveT(MatSimple &P, MatSimple &w, const
> | MatSimple &r) {
> | int rows = P.rows;
> | int nrhs = 1;
> | int lda = rows;
> | int ldb = rows;
> | int info = -1;
> | MatSimple ipivot(1,rows);
> | w.Inject(r);// copy r to w;
> | F77_CALL(dgetrf)(&rows, &rows, &P(0,0), &lda, &ipivot(0,0),
> &info);
> | if (info!=0) {
> | cout << "Error in LASolve (dgetrf). Info=" << info << endl;
> | return 1;
> | }
> | F77_CALL(dgetrs)("T", &rows, &nrhs, &P(0,0), &lda, &ipivot(0,0),
> | &w(0,0), &ldb, &info);("T", &rows, &nrhs, &P(0,0), &lda, &ipivot(0,0),
> | &w(0,0), &ldb, &info);
> | if (info!=0) {
> | cout << "Error in LASolve (dgetrs). Info=" << info << endl;
> | return 1;
> | }
> | return 0;
> | }
> |
> | When compiling the package on using R-devel the error for
> F77_CALL(dgetrs)
> | occur:
> |
> | matalg.h:67:25: error: too few arguments to function ‘void dgetrs_(const
> | char*, const int*, const int*, const double*, const int*, const int*,
> | double*, const int*, int*, size_t)’
> |67 | F77_CALL(dgetrs)("T", &rows, &nrhs, &P(0,0), &lda,
> | &ipivot(0,0), &w(0,0), &ldb, &info);
> |
> | It works in R-release and I guess it have something to do with
> | https://cran.r-project.org/doc/manuals/r-devel/NEWS.html and LAPACK.
> |
> | Any hints on how to get it to work for both R-release and R-devel.
>
> I can offer you two answers. The first, and narrower, is in Writing R
> Extensions and concerns FC_LEN. R now 'automagically' injects additional
> parameters for a better, more stringent, control of character variable
> length. See eg
>
>
> https://rstudio.github.io/r-manuals/r-exts/The-R-API.html#fortran-character-strings
>
> and related. (And this isn't new per se, those of use with packages with
> Fortran interfaces have been keeping this up.)
>
> The second, more pragmatic answer, is of course 'to not do that' but to
> rely
> on the decade of tuning and bazillion of test and runs a higher-end Linear
> Algebra package like (Rcpp)Armadillo offers by wrapping around LAPACK and
> BLAS for you.  You already are in C++, so there os essentially no switching
> cost. And (Rcpp)Armadillo is header-only and hence free of added
> complications.
>
> Dirk
>
> --
> dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Problem with accessibility in R 4.2.0 and 4.2.1.

2022-12-21 Thread Andrew Hart via R-devel

HI Tomas,

Thanks a lot for not letting this go. It is truly appreciated. I had 
been using Rterm directly as Jonathan had suggested since we discussed 
this a number of months ago on the R-devel list. However, about a week 
and a half ago I accidentally launched Rgui for R 4.2.2 (which I 
installed around the end of October) and was surprised when I could 
actually  use it like I could use the pre-4.2 versions of R! I have been 
using it for a little more than a week now and was intending to write to 
you, but you beat me with this message.
The accessibility of Rgui 4.2.2 seems very similar to R 4.1.2 (which I 
still have on my system). In contrast, Rgui 4.2.1 is more or less 
unusable. I was wanting to ask you if perhaps something got changed in R 
4.2.2? Nothing jumped out at me in the release notes, but I could easily 
have overlooked something.


After reading this message, I went and checked the cursor blink setting 
in my 4.2.2 installation and it is indeed set to partial. You're right 
in that occasionally JAWS loses the cursor and the ability to read the R 
window. However, simply pressing the  key while Rgui has the 
focus fixes this. It seems that drawing a new command prompt on a new 
line sets JAWS straight and I am able to keep working. I haven't used 
4.1.2 for a while, but I think it had the same issue. I assumed that 
this was caused by moving from Windows 7 to Windows 10, since I never 
encountered this kind of issue in windows 7. I'll try out full cursor 
and see if that makes a difference in 4.2.2.


Also, I'll download the development snapshot and try it out. I'll let 
you know how I get on. Please excuse me if I don't get to it 
immediately; things are a bit crazy at work at the moment and it is that 
time of the year too!


Cheers,
Andrew.

On 20/12/2022 19:33, Tomas Kalibera wrote:

Dear Andrew, Jonathan,

I had a closer look and tried to improve accessibility in Rgui, please 
see below. I would be grateful for feedback.


Rgui supports three cursor types, which can be selected via Edit/GUI 
preferences/Cursor blink.


The default is "partial", but for screen readers, please use "full". You 
can change the selection in the menu and then "Save..." to save it into 
your Rconsole file. If you already have the file, the corresponding 
selection is "cursor_blink = Full".


The "full" cursor is implemented as the standard Windows "caret" and 
this is what screen readers can see. Once you set this cursor as the 
default in your Rconsole file and re-start Rgui, but before you start 
using the console, please switch focus out and back in (e.g. press 
Alt+TAB twice). This helps NVDA detect the characters under the cursor 
in already released versions of R. Please start the screen reader before 
starting Rgui.


I found that the "full" cursor implementation has a number of problems: 
in some situation it disappears when it shouldn't, in some the other way 
around. I thought this was confusing the screen reader, so I fixed most 
of these cases.


However, the true cause was that Rgui didn't create the cursor right 
when it got focus the first time. Luckily NVDA is open-source, so one 
can read and modify the source code to find out. I've added a 
work-around to Rgui, which is used only with the "full" cursor, because 
the "partial" cursor confuses the screen reader too much to be usable, 
anyway. So, after this fix, one doesn't have to do that focus out+in trick.


The improvements are in R-devel (revision 83482 or newer). I would be 
grateful if you could test it, so that it could be improved further (or 
reverted if it actually turned out worse). Particularly if you find a 
problem reproducible with NVDA, that should be something I could 
diagnose and improve, as I have the sources.


I've been testing with NVDA and I'd be curious about the impact on JAWS.
Rgui doesn't work with Narrator.

Thanks,
Tomas

On 9/22/22 23:15, Andrew Hart via R-devel wrote:

On 22/09/2022 16:42, Toby Hocking wrote:
Another option is to use https://emacspeak.sourceforge.net/ 
 (version of emacs editor/ide 
which can speak letters/words/lines -- has a blind maintainer) with 
https://ess.r-project.org/  (interface 
for editing and running R code from within emacs)


Thanks everyone for all the suggestions. Of course, the optimal 
solution would be to figure out what is going on in Rgui, but, as is 
always the case, the blind user use case is a fairly niche one. I 
appreciate all the suggestions for finding an immediate solution to my 
problem.
I don't use any kind of IDE for working with R since I simply haven't 
found one that is accessible or that i understand how to use. There is 
a plug-in for the Eclipse IDE I installed a few years ago, but I 
didn't understand the first thing about how it was to be used. So I've 
just always worked with an editor open in one Window and R in another,
working interactively in R or bouncing over to the editor for

Re: [Rd] Problem with accessibility in R 4.2.0 and 4.2.1.

2022-12-21 Thread Tomas Kalibera

Hi Andrew,

thanks a lot for your testing and I am looking forward to what you find 
out about the fixes in R-devel.


You asked about changes between 4.2.1 and 4.2.2 relevant to this. I 
don't think you overlooked anything, I looked now again at the source 
code diff and I didn't find anything relevant. The Rgui console was 
fixed to work with Alt+sequences (tilde on Italian keyboard). GraphApp 
was fixed to use the correct font charset for UTF-8 in dialog boxes. 
Search and replace was fixed in the script editor. Invalid write was 
fixed with printing very long lines.


None of those changes should impact the behavior of the caret in the 
console window. I would not be surprised if the behavior with the screen 
reader was unpredictable/random, certainly inconsequential to whether we 
had R 4.2.1 or 4.2.2. Hopefully the changes now in R-devel would make it 
more reliable. If not, we can try to improve it further.


Thanks for testing with JAWS, I am impressed it can get anything out 
from Rgui with the partial cursor. NVDA cannot, it allows navigating 
using left arrow/right arrow over the line (after focus out+in in R 
4.2.2), but it thinks that the characters on the line are all spaces.


In either case, I think using the partial cursor with screen readers 
doesn't make sense, it could only confuse the screen reader application. 
If some people preferred a wider cursor than "full", we could add a 
"wide full" cursor, that would be quite easy. If some people preferred 
less blinking or no blinking at all, they can already set that up 
system-wide in Windows for the "full" (or potential "wide full") cursor.


Cheers
Tomas

On 12/21/22 17:12, Andrew Hart wrote:

HI Tomas,

Thanks a lot for not letting this go. It is truly appreciated. I had 
been using Rterm directly as Jonathan had suggested since we discussed 
this a number of months ago on the R-devel list. However, about a week 
and a half ago I accidentally launched Rgui for R 4.2.2 (which I 
installed around the end of October) and was surprised when I could 
actually  use it like I could use the pre-4.2 versions of R! I have 
been using it for a little more than a week now and was intending to 
write to you, but you beat me with this message.
The accessibility of Rgui 4.2.2 seems very similar to R 4.1.2 (which I 
still have on my system). In contrast, Rgui 4.2.1 is more or less 
unusable. I was wanting to ask you if perhaps something got changed in 
R 4.2.2? Nothing jumped out at me in the release notes, but I could 
easily have overlooked something.


After reading this message, I went and checked the cursor blink 
setting in my 4.2.2 installation and it is indeed set to partial. 
You're right in that occasionally JAWS loses the cursor and the 
ability to read the R window. However, simply pressing the  key 
while Rgui has the focus fixes this. It seems that drawing a new 
command prompt on a new line sets JAWS straight and I am able to keep 
working. I haven't used 4.1.2 for a while, but I think it had the same 
issue. I assumed that this was caused by moving from Windows 7 to 
Windows 10, since I never encountered this kind of issue in windows 7. 
I'll try out full cursor and see if that makes a difference in 4.2.2.


Also, I'll download the development snapshot and try it out. I'll let 
you know how I get on. Please excuse me if I don't get to it 
immediately; things are a bit crazy at work at the moment and it is 
that time of the year too!


Cheers,
Andrew.

On 20/12/2022 19:33, Tomas Kalibera wrote:

Dear Andrew, Jonathan,

I had a closer look and tried to improve accessibility in Rgui, 
please see below. I would be grateful for feedback.


Rgui supports three cursor types, which can be selected via Edit/GUI 
preferences/Cursor blink.


The default is "partial", but for screen readers, please use "full". 
You can change the selection in the menu and then "Save..." to save 
it into your Rconsole file. If you already have the file, the 
corresponding selection is "cursor_blink = Full".


The "full" cursor is implemented as the standard Windows "caret" and 
this is what screen readers can see. Once you set this cursor as the 
default in your Rconsole file and re-start Rgui, but before you start 
using the console, please switch focus out and back in (e.g. press 
Alt+TAB twice). This helps NVDA detect the characters under the 
cursor in already released versions of R. Please start the screen 
reader before starting Rgui.


I found that the "full" cursor implementation has a number of 
problems: in some situation it disappears when it shouldn't, in some 
the other way around. I thought this was confusing the screen reader, 
so I fixed most of these cases.


However, the true cause was that Rgui didn't create the cursor right 
when it got focus the first time. Luckily NVDA is open-source, so one 
can read and modify the source code to find out. I've added a 
work-around to Rgui, which is used only with the "full" cursor, 
because the "partial" cur

Re: [Rd] Problem with accessibility in R 4.2.0 and 4.2.1.

2022-12-21 Thread Jonathan Godfrey
Hello both,

I so seldom use the RGUI that I hand't noticed it was behaving nicely in 4.2.2 
which has been running on my laptop for a long time!

I confirm the JAWS experience is back to what I expected prior to 4.2.0 and 
assure you that I do nothing to alter the default settings. I do think 
maintaining the usefulness of the GUI has merit because that is what a new R 
user will end up trying once they discover RStudio's inaccessibility.

I really do not understand how/why switching a cosmetic element of a cursor 
should lead to changes in the screen reader performance. I'm sure the size, 
shape, and colour of a mouse pointer  doesn't affect it's performance although 
I would expect it to have an impact on a user's performance.

Rather, I assumed that the change in the cosmetics of the cursor was the 
symptom of an underlying change that had multiple impacts, one of which was the 
disconnect with the screen reader. 

Did the underlying development toolbox undergo any version changes from ( 
<4.2.0 ) to (4.2.0...4.2.1) to (4.2.2) ??

Great that normal transmission has resumed.

Jonathan


-Original Message-
From: Tomas Kalibera  
Sent: Thursday, 22 December 2022 6:53 am
To: Andrew Hart ; Jonathan Godfrey 

Cc: R-devel@r-project.org
Subject: Re: [Rd] Problem with accessibility in R 4.2.0 and 4.2.1.

Hi Andrew,

thanks a lot for your testing and I am looking forward to what you find 
out about the fixes in R-devel.

You asked about changes between 4.2.1 and 4.2.2 relevant to this. I 
don't think you overlooked anything, I looked now again at the source 
code diff and I didn't find anything relevant. The Rgui console was 
fixed to work with Alt+sequences (tilde on Italian keyboard). GraphApp 
was fixed to use the correct font charset for UTF-8 in dialog boxes. 
Search and replace was fixed in the script editor. Invalid write was 
fixed with printing very long lines.

None of those changes should impact the behavior of the caret in the 
console window. I would not be surprised if the behavior with the screen 
reader was unpredictable/random, certainly inconsequential to whether we 
had R 4.2.1 or 4.2.2. Hopefully the changes now in R-devel would make it 
more reliable. If not, we can try to improve it further.

Thanks for testing with JAWS, I am impressed it can get anything out 
from Rgui with the partial cursor. NVDA cannot, it allows navigating 
using left arrow/right arrow over the line (after focus out+in in R 
4.2.2), but it thinks that the characters on the line are all spaces.

In either case, I think using the partial cursor with screen readers 
doesn't make sense, it could only confuse the screen reader application. 
If some people preferred a wider cursor than "full", we could add a 
"wide full" cursor, that would be quite easy. If some people preferred 
less blinking or no blinking at all, they can already set that up 
system-wide in Windows for the "full" (or potential "wide full") cursor.

Cheers
Tomas

On 12/21/22 17:12, Andrew Hart wrote:
> HI Tomas,
>
> Thanks a lot for not letting this go. It is truly appreciated. I had 
> been using Rterm directly as Jonathan had suggested since we discussed 
> this a number of months ago on the R-devel list. However, about a week 
> and a half ago I accidentally launched Rgui for R 4.2.2 (which I 
> installed around the end of October) and was surprised when I could 
> actually  use it like I could use the pre-4.2 versions of R! I have 
> been using it for a little more than a week now and was intending to 
> write to you, but you beat me with this message.
> The accessibility of Rgui 4.2.2 seems very similar to R 4.1.2 (which I 
> still have on my system). In contrast, Rgui 4.2.1 is more or less 
> unusable. I was wanting to ask you if perhaps something got changed in 
> R 4.2.2? Nothing jumped out at me in the release notes, but I could 
> easily have overlooked something.
>
> After reading this message, I went and checked the cursor blink 
> setting in my 4.2.2 installation and it is indeed set to partial. 
> You're right in that occasionally JAWS loses the cursor and the 
> ability to read the R window. However, simply pressing the  key 
> while Rgui has the focus fixes this. It seems that drawing a new 
> command prompt on a new line sets JAWS straight and I am able to keep 
> working. I haven't used 4.1.2 for a while, but I think it had the same 
> issue. I assumed that this was caused by moving from Windows 7 to 
> Windows 10, since I never encountered this kind of issue in windows 7. 
> I'll try out full cursor and see if that makes a difference in 4.2.2.
>
> Also, I'll download the development snapshot and try it out. I'll let 
> you know how I get on. Please excuse me if I don't get to it 
> immediately; things are a bit crazy at work at the moment and it is 
> that time of the year too!
>
> Cheers,
> Andrew.
>
> On 20/12/2022 19:33, Tomas Kalibera wrote:
>> Dear Andrew, Jonathan,
>>
>> I had a closer look and tried to improve accessibili