Books about data structures and algorithms but specifically focusing on parallel gpgpu programming

I’m looking for a book on the subject of algorithms and data structures, but I want to specifically learn about the parallel implementations. Books that teach CUDA and OpenCL usually have small sections that briefly touch on this subject, but they are mostly focused on technicalities. I’m looking for something more fundamental and theoretical.

I hope to later apply those techniques to problems in scientific computing, computational physics and simulations. If the book touches on those subjects, that’s even better, but not strictly necessary.

Running Hec-HMS from R programming language

I would like to use the Dynamically Dimensioned Search (DDS) algorithm to calibrate the Hec-HMS hydrological model. As DDS is developed in R language. I tried to run Hec-HMS from R, but I couldn’t do it. Could you help?

programming – How to use Intersection[] but keep the original list order

One way to keep the order in l1 is this:

l1 = {"qwe", "abc", "abb", "aba", "ddd"};
l2 = {"abc", "abd", "aba", "qwe"};
Select[l1, MemberQ[l2, #] &]//InputForm

which evaluates to {"qwe", "abc", "aba"}. The
Select function has been in Mathematica since
version 1.0, otherwise the alternative
Map[If[MemberQ[l2, #], #, Nothing] &, l1]
does the same thing.

windows – PowerShell Programming: Traverse folders and subfolders and apply pdftotext. I/O Error

I have correctly written the following PowerShell command to traverse every folder and subfolder of a directory and display the contents of each such folders:

Get-ChildItem -Path "C:whiskeyTangoCharlie" –Recurse

I have also written a PowerShell script that correctly works and can extract text from each pdf file in a single folder.

cd "C:whiskey"
$FILES= ls *.pdf
foreach ($f in $FILES) {
  & "C:Program Filesxpdf-tools-win-4.02bin32pdftotext.exe" -enc UTF-8 "$f"
}

I am trying to combine both scripts in order to traverse all folders and subfolders and execute the pdftotext program. And so I wrote:

$files=Get-ChildItem -Path "C:whiskeyTangoCharlie" –Recurse
foreach ($f in $files){
    & "C:Program Filesxpdf-tools-win-4.02bin32pdftotext.exe" -enc UTF-8 "$f"
}

; which is incorrect. I receive the following error: pdftotext.exe : I/O Error: Couldn’t open file. Note none of the pdf files are protected.

Question: How do I correct this error?

python – Standards for explaining a simple programming function

If I want from an associate to write a simple module (software function – python to say more clearly), and considering writing a SDD is overkill for this task, how would you explain it to him briefly?

  • The inputs of the function
  • The expected outputs
  • Expected error handling (raising specific errors when needed to)
  • Other limitations

Are there any standards for this; especially in pyhthon?

programming languages – Is there a simple algorithm for generating unit tests given a function’s code?

Given the abstract syntax tree (AST) of each line of a function’s code, I am asked to generate code for that function’s corresponding unit tests, similar to what Microsoft’s IntelliTest tool does here: https://docs.microsoft.com/en-us/visualstudio/test/generate-unit-tests-for-your-code-with-intellitest?view=vs-2019.

The issue is that I have to implement this from scratch instead of using built-in tools, since my project is implementing an ABAP to C# interpreter (ABAP is a programming language used for SAP’s enterprise software), which executes ABAP code in C#, so I cannot just use an IDE’s unit test generation tool.

I so far have decided that the first part of the algorithm is to generate the function’s parameters, but I’m not sure how I’m going to generate the function’s parameters exactly. Furthermore, I don’t know how the unit test generator is going to compute the expected outputs of the function.

Note: This algorithm doesn’t need to be an algorithm that works as well as an IDE’s automatic unit test generation, I just need to be able to come up with an algorithm that is an initial working prototype. But so far, I am stumped, and haven’t found any good online resources regarding this topic.

programming languages – what is the formula used in the scale_quantile function in R?

I want to know what formula is being is in the package scale_quantile by the dynutils package. I want to check if I can achieve the same results as with manual calculations like this

# Air quality dataset
data = datasets::airquality

# Manual calculation
dat = data$Wind

#Calcuate quantile
q_995 = quantile(dat, 0.995)
q_005 = quantile(dat, 0.005)

#Filtering the data based on the quantile value
dat = dat(dat >= q_005 & dat <= q_995)

MEAN = mean(dat)
SD = sd(dat)

manual = (dat - MEAN)/SD

. This is the site I referred for documentation, Documentation of scale_quantile

java – How do I know if I’m taking too much time to solve a programming problem?

I’m learning Java for a few months, mainly through the Deitel‘s book “Java – How To Program, 10th Edition“, and now I am on the Chapter 7 learning about Arrays and ArrayLists where things started to get harder, so I decided to go back to Ch.4 to solve its questions (that I skipped) and improve my skills.

After 1h30min programming the Q17, I finally solved it and then found myself in the following question: “Am I taking a long time to solve these problems? Am I going around and around with something that could have been solved in a much simpler way?”.

As a beginner, I have no idea if this is a good time or not. I’d like to receive some opinions from experienced programmers and some tips to improve myself more and more.

Here’s the mentioned question:

4.17 (Gas Mileage) Drivers are concerned with the mileage their automobiles get. One driver has kept track of several trips by
recording the miles driven and gallons used for each tankful. Develop
a Java application that will input the miles driven and gallons used
(both as integers) for each trip. The program should calculate and
display the miles per gallon obtained for each trip and print the
combined miles per gallon obtained for all trips up to this point. All
averaging calculations should produce floating-point results. Use
class Scanner and sentinel-controlled repetition to obtain the data
from the user.

mathematical programming – Is computing subgradients an open research area in Authomatic Differentiation

Large portions of the possible research areas in Automatic Differentiation have broadly defined known solutions; most of which were derived in the 80s and 90s.
Compute vector jacobian products: use reverse mode.
Compute jacobian vector products: use forwards mode.
(other things are a bit less solved, but still we have a solid idea what the solution space is e.g. computing whole jacobians using mixed mode, and computing single partial derivatives using cross-country)
There is a lot of work and refinements and tweaks to those ideas that is still active research today,
and also a lot if implementations and innovations there.
But the core of the ideas are well-established.

Is this also the case for computing subgradients?
Is current work variations on existing ideas,
or is current work proposing whole new ideas?

python – Is there a faster solution to this – Programming challenge

I am trying to solve this question, But I am getting time exceeded error in some of the test cases. I want to know if there are any other optimized solutions that I am missing on. I have pasted my solution below which is correct but for some reason, the judge thinks its too slow for some of the test cases. Please advise.

enter image description here

My Solution:

from typing import List
from collections import deque


def getMaximumEatenDishCount(N: int, D: List(int), K: int) -> int:
  dishesEatenQ = deque(maxlen=K)
  canEat = 0
  for dish in D:
    try:
      if(dishesEatenQ.index(dish)):
        pass
    except ValueError as e:
      dishesEatenQ.append(dish)
      canEat += 1
    
  
  return canEat