Skip to content

Commit

Permalink
🤖 Format .jl files (#96)
Browse files Browse the repository at this point in the history
Co-authored-by: d-monnet <[email protected]>
  • Loading branch information
github-actions[bot] and d-monnet authored Oct 17, 2023
1 parent db8d62c commit 65d4a5b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions src/performance_profiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,30 +181,30 @@ function export_performance_profile(
filename::String;
solver_names::Vector{S} = String[],
header::Vector{S} = String[],
kwargs...
kwargs...,
) where {S <: AbstractString}
nsolvers = size(T)[2]

x_data, y_data, max_ratio = performance_profile_data(T;kwargs...)
x_data, y_data, max_ratio = performance_profile_data(T; kwargs...)
max_elem = maximum(length.(x_data))
for i in eachindex(x_data)
append!(x_data[i],[NaN for i=1:max_elem-length(x_data[i])])
append!(y_data[i],[NaN for i=1:max_elem-length(y_data[i])])
append!(x_data[i], [NaN for i = 1:(max_elem - length(x_data[i]))])
append!(y_data[i], [NaN for i = 1:(max_elem - length(y_data[i]))])
end
x_mat = hcat(x_data...)
y_mat = hcat(y_data...)

isempty(solver_names) && (solver_names = ["solver_$i" for i = 1:nsolvers])

if !isempty(header)
header_l = size(T)[2]*2
header_l = size(T)[2] * 2
length(header) == header_l || error("Header should contain $(header_l) elements")
header = vcat([[sname*"_x",sname*"_y"] for sname in solver_names]...)
header = vcat([[sname * "_x", sname * "_y"] for sname in solver_names]...)
end
data = Matrix{Float64}(undef,max_elem,nsolvers*2)
for i =0:nsolvers-1
data[:,2*i+1] .= x_mat[:,i+1]
data[:,2*i+2] .= y_mat[:,i+1]
data = Matrix{Float64}(undef, max_elem, nsolvers * 2)
for i = 0:(nsolvers - 1)
data[:, 2 * i + 1] .= x_mat[:, i + 1]
data[:, 2 * i + 2] .= y_mat[:, i + 1]
end
CSV.write(filename,Tables.table(data),header=header)
CSV.write(filename, Tables.table(data), header = header)
end
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ if !Sys.isfreebsd() # GR_jll not available, so Plots won't install
@testset "csv export" begin
T = 10 * rand(25, 3)
filename = "data.csv"
export_performance_profile(T,filename)
export_performance_profile(T, filename)
@test isfile(filename)
rm(filename)
export_performance_profile(T,filename,header = ["" for _=1:size(T,2)*2])
export_performance_profile(T, filename, header = ["" for _ = 1:(size(T, 2) * 2)])
@test isfile(filename)
rm(filename)
end
Expand Down

0 comments on commit 65d4a5b

Please sign in to comment.