licenses
sequencelengths 1
3
| version
stringclasses 677
values | tree_hash
stringlengths 40
40
| path
stringclasses 1
value | type
stringclasses 2
values | size
stringlengths 2
8
| text
stringlengths 25
67.1M
| package_name
stringlengths 2
41
| repo
stringlengths 33
86
|
---|---|---|---|---|---|---|---|---|
[
"MIT"
] | 0.1.4 | 781292162fd5bfe8d001210f9dddbb6baa509bf4 | docs | 2400 | ```@meta
CurrentModule = Fetch
```
# Fetch
Documentation for [Fetch](https://github.com/foldfelis/Fetch.jl).
## Quick start
The package can be installed with the Julia package manager.
From the Julia REPL, type ] to enter the Pkg REPL mode and run:
```julia
pkg> add Fetch
```
## Download file from Google drive
Download file or Google Sheet from Google drive via the share link:
```julia
using Fetch
link = "https://drive.google.com/file/d/1OiX6gEWRm57kb1H8L0K_HWN_pzc-sk8y/view?usp=sharing"
gdownload(link, pwd())
```
## Download dataset from Kaggle
Download dataset from Kaggle via the name:
```julia
using Fetch
dataset = "ningjingyu/fetchtest"
kdownload(dataset, pwd())
```
Or via the url of the home page of the dataset:
```julia
using Fetch
url = "https://www.kaggle.com/ningjingyu/fetchtest"
kdownload(url, pwd())
```
## Intergrate with DataDeps.jl
According to [DataDeps.jl](https://github.com/oxinabox/DataDeps.jl),
`DataDep` can be construct as following:
```julia
DataDep(
name::String,
message::String,
remote_path::Union{String,Vector{String}...},
[checksum::Union{String,Vector{String}...},];
fetch_method=fetch_default
post_fetch_method=identity
)
```
By using `Fetch.jl`, one can upload their dataset to Google drive,
and construct `DataDep` by setting `fetch_method=gdownload`.
```julia
using DataDeps
using Fetch
register(DataDep(
"FetchTest",
"""Test dataset""",
"https://drive.google.com/file/d/1OiX6gEWRm57kb1H8L0K_HWN_pzc-sk8y/view?usp=sharing",
"b083597a25bec4c82c2060651be40c0bb71075b472d3b0fabd85af92cc4a7076",
fetch_method=gdownload,
post_fetch_method=unpack
))
datadep"FetchTest"
```
Or to Kaggle
```julia
using DataDeps
using Fetch
register(DataDep(
"FetchTest",
"""Test dataset""",
"ningjingyu/fetchtest",
"65492e1f4c6affb7955125e5e4cece2bb547e482627f3af9812c06448dae40a9",
fetch_method=kdownload,
post_fetch_method=unpack
))
datadep"FetchTest"
```
According to the document of [Kaggle-api](https://github.com/Kaggle/kaggle-api#api-credentials)
one needs to set their environment variables `KAGGLE_USERNAME` and `KAGGLE_KEY`,
or simply download the api token from Kaggle, and place this file in the location `~/.kaggle/kaggle.json`
(on Windows in the location `C:\Users\<Windows-username>\.kaggle\kaggle.json`).
## Index
```@index
```
```@autodocs
Modules = [Fetch]
```
| Fetch | https://github.com/foldfelis/Fetch.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 761 | using Documenter, Literate
using Tk
Literate.markdown("../examples/manipulate.jl", "src/examples"; documenter=true)
Literate.markdown("../examples/process.jl", "src/examples"; documenter=true)
Literate.markdown("../examples/sketch.jl", "src/examples"; documenter=true)
Literate.markdown("../examples/test.jl", "src/examples"; documenter=true)
makedocs(modules = [Tk],
sitename = "Tk.jl",
pages = Any[
"Home" => "index.md",
"More" => Any[
"Manipulate" => "examples/manipulate.md",
"Process" => "examples/process.md",
"Sketch" => "examples/sketch.md",
"Test" => "examples/test.md"
],
"API Reference" => "api.md"
])
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 5508 | # This is an example mimicking RStudio's `manipulate` package (inspired by Mathematica's no doubt)
# The manipulate function makes it easy to create "interactive" GUIs. In this case, we can
# dynamically control parameters of a `Winston` graph.
# To add a control is easy. There are just a few: slider, picker, checkbox, button, and entry
using Winston
using Tk
using Compat; import Compat.String
function render(c, p)
ctx = getgc(c)
Base.Graphics.set_source_rgb(ctx, 1, 1, 1)
Base.Graphics.paint(ctx)
Winston.page_compose(p, Tk.cairo_surface(c))
reveal(c)
Tk.update()
end
# do a manipulate type thing
# context to store dynamic values
module ManipulateContext
using Winston
end
abstract type ManipulateWidget end
get_label(widget::ManipulateWidget) = widget.label
mutable struct SliderWidget <: ManipulateWidget
nm
label
initial
rng
end
function make_widget(parent, widget::SliderWidget)
sl = Slider(parent, widget.rng)
set_value(sl, widget.initial)
sl
end
slider(nm::AbstractString, label::AbstractString, rng::UnitRange, initial::Integer) = SliderWidget(nm, label, initial, rng)
slider(nm::AbstractString, label::AbstractString, rng::UnitRange) = slider(nm, label, rng, minimum(rng))
slider(nm::AbstractString, rng::UnitRange) = slider(nm, nm, rng, minimum(rng))
mutable struct PickerWidget <: ManipulateWidget
nm
label
initial
vals
end
function make_widget(parent, widget::PickerWidget)
cb = Combobox(parent)
set_items(cb, widget.vals)
set_value(cb, widget.initial)
set_editable(cb, false)
cb
end
picker(nm::AbstractString, label::AbstractString, vals::Vector{T}, initial) where {T <: AbstractString} = PickerWidget(nm, label, initial, vals)
picker(nm::AbstractString, label::AbstractString, vals::Vector{T}) where {T <: AbstractString} = picker(nm, label, vals, vals[1])
picker(nm::AbstractString, vals::Vector{T}) where {T <: AbstractString} = picker(nm, nm, vals)
picker(nm::AbstractString, label::AbstractString, vals::Dict, initial) = PickerWidget(nm, label, vals, initial)
picker(nm::AbstractString, label::AbstractString, vals::Dict) = PickerWidget(nm, label, vals, [string(k) for (k,v) in vals][1])
picker(nm::AbstractString, vals::Dict) = picker(nm, nm, vals)
mutable struct CheckboxWidget <: ManipulateWidget
nm
label
initial
end
function make_widget(parent, widget::CheckboxWidget)
w = Checkbutton(parent, widget.label)
set_value(w, widget.initial)
w
end
get_label(widget::CheckboxWidget) = nothing
checkbox(nm::AbstractString, label::AbstractString, initial::Bool) = CheckboxWidget(nm, label, initial)
checkbox(nm::AbstractString, label::AbstractString) = checkbox(nm, label, false)
mutable struct ButtonWidget <: ManipulateWidget
label
nm
end
make_widget(parent, widget::ButtonWidget) = Button(parent, widget.label)
get_label(widget::ButtonWidget) = nothing
button(label::AbstractString) = ButtonWidget(label, nothing)
# Add text widget to gather one-line of text
mutable struct EntryWidget <: ManipulateWidget
nm
label
initial
end
make_widget(parent, widget::EntryWidget) = Entry(parent, widget.initial)
entry(nm::AbstractString, label::AbstractString, initial::AbstractString) = EntryWidget(nm, label, initial)
entry(nm::AbstractString, initial::AbstractString) = EntryWidget(nm, nm, initial)
entry(nm::AbstractString) = EntryWidget(nm, nm, "{}")
# Expression returns a plot object. Use names as values
function manipulate(ex::(Union{Symbol,Expr}), controls...)
widgets = Array(Tk.Widget, 0)
w = Toplevel("Manipulate", 800, 500)
pack_stop_propagate(w)
graph = Canvas(w, 500, 500); pack(graph, side="left")
control_pane= Frame(w); pack(control_pane, side="left", expand=true, fill="both")
## create, layout widgets
for i in controls
widget = make_widget(control_pane, i)
push!(widgets, widget)
formlayout(widget, get_label(i))
end
get_values() = [get_value(i) for i in widgets]
get_nms() = map(u -> u.nm, controls)
function get_vals()
d = Dict() # return Dict of values
vals = get_values(); keys = get_nms()
for i in 1:length(vals)
if !isa(keys[i], Nothing)
d[keys[i]] = vals[i]
end
end
d
end
function dict_to_module(d::Dict) ## stuff values into Manipulate Context
for (k,v) in d
eval(ManipulateContext, :($(Symbol(k)) = $v))
end
end
function make_graphic(x...)
d = get_vals()
dict_to_module(d)
p = eval(ManipulateContext, ex)
render(graph, p)
end
map(u -> callback_add(u, make_graphic), widgets)
widgets
end
# we need to make an expression.
# here we need to
# * use semicolon (perhaps)
# * return p, the FramedPlot object to draw
ex = quote
x = linspace( 0, n * pi, 100 )
c = cos(x)
s = sin(x)
p = FramedPlot()
setattr(p, "title", title)
if fillbetween
add(p, FillBetween(x, c, x, s) )
end
add(p, Curve(x, c, "color", color) )
add(p, Curve(x, s, "color", "blue") )
file(p, "example1.png")
p
end
obj = manipulate(ex,
slider("n", "[0, n*pi]", 1:10)
,entry("title", "Title", "title")
,checkbox("fillbetween", "Fill between?", true)
,picker("color", "Cos color", ["red", "green", "yellow"])
,button("update")
)
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 181 | f = "logo.gif"
using Base64
function process_file(f)
a = readchomp(`cat $f`)
"<!-- $f -->\n<img src='data:image/gif;base64,$(base64encode(a))'></img>"
end
process_file(f)
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 531 | using Tk
using Graphics
function sketch_window()
w = Window("drawing", 400, 300)
c = Canvas(w)
pack(c)
lastx = 0
lasty = 0
cr = getgc(c)
set_source_rgb(cr, 1, 1, 1)
paint(cr)
reveal(c)
set_source_rgb(cr, 0, 0, 0.85)
c.mouse.button1press = function (c, x, y)
lastx = x; lasty = y
end
c.mouse.button1motion = function (c, x, y)
move_to(cr, lastx, lasty)
line_to(cr, x, y)
stroke(cr)
reveal(c)
lastx = x; lasty = y
end
c
end
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 1073 | # Example of widgets put into container with change handler assigned
using Tk
w = Toplevel("Test window", false)
# pack in tk frame for themed widgets
f = Frame(w)
configure(f, Dict(:padding => [3,3,2,2], :relief=>"groove"))
pack(f, expand=true, fill="both")
# widgets
b = Button(f, "one")
cb = Checkbutton(f, "checkbutton")
rg = Radio(f, ["one", "two", "trhee"])
sc = Slider(f, 1:10)
sl = Spinbox(f, 1:10)
e = Entry(f, "starting text")
widgets = (b, cb, rg, sc, sl, e)
# oops, typo!
set_items(rg.buttons[3], "three")
# packing
pack_style = ["pack", "grid", "formlayout"][3]
if pack_style == "pack"
map(pack, widgets)
map(u -> pack_configure(u, Dict(:anchor => "w")), widgets)
elseif pack_style == "grid"
for i in 1:length(widgets)
grid(widgets[i], i, 1)
grid_configure(widgets[i], Dict(:sticky => "we"))
end
else
map(u -> formlayout(u, "label"), widgets)
end
# bind a callback to each widget
change_handler(path,xs...) = println(map(get_value, widgets))
map(u -> callback_add(u, change_handler), widgets)
set_visible(w, true)
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 2726 | ## simple workspace browser for julia
using Tk
## Some functions to work with a module
function get_names(m::Module)
sort!(map(string, names(m)))
end
unique_id(v::Symbol, m::Module) = isdefined(m,v) ? unique_id(Base.eval(m,v)) : ""
unique_id(x) = string(objectid(x))
## short_summary
## can customize description here
short_summary(x) = summary(x)
short_summary(x::AbstractString) = "A string"
## update ids, returning false if the same, true if not
__ids__ = Vector{AbstractString}()
function update_ids(m::Module)
global __ids__
nms = get_names(m)
nms = filter(u -> u != "__ids__", nms)
a_ids = map(u -> unique_id(Symbol(u), m), nms)
if __ids__ == a_ids
false
else
__ids__ = a_ids
true
end
end
negate(x::Bool, val::Bool) = val ? !x : x
const MaybeRegex = Union{Nothing, Regex}
const MaybeType = Union{Nothing, DataType}
## get array of names and summaries
## m module
## pat regular expression to filter by
## dtype: DataType or Union to filter out by.
## dtypefilter: If true not these types, if false only these types
function get_names_summaries(m::Module, pat::MaybeRegex, dtype::MaybeType, dtypefilter::Bool)
nms = get_names(m)
if pat != nothing
nms = filter(s -> ismatch(pat, s), nms)
end
## filter out this type
if dtype != nothing
nms = filter(u -> isdefined(m, Symbol(u)) && negate(isa(Base.eval(m,Symbol(u)), dtype), dtypefilter), nms)
end
summaries = map(u -> isdefined(m, Symbol(u)) ? short_summary(Base.eval(m,Symbol(u))) : "undefined", nms)
if length(nms) == length(summaries)
return [nms summaries]
else
return nothing # didn't match
end
end
get_names_summaries(m::Module, pat::Regex) = get_names_summaries(m, pat, nothing, true)
get_names_summaries(m::Module, dtype::MaybeType) = get_names_summaries(m, nothing, dtype, true)
get_names_summaries(m::Module) = get_names_summaries(m::Module, nothing, nothing, true)
## Simple layout for our tree view.
w = Toplevel("Workspace", 600, 600)
f = Frame(w)
pack_stop_propagate(w)
pack(f, expand=true, fill="both")
tv = Treeview(f, get_names_summaries(Main, nothing, (Module), true))
tree_key_header(tv, "Object")
tree_headers(tv, ["Summary"])
scrollbars_add(f, tv)
## add a callback. Here we get the obj clicked on.
callback_add(tv, (path) -> begin
val = get_value(tv)[1]
obj = Base.eval(Main, Symbol(val))
println(short_summary(obj))
end)
## Update values after 1000ms. Call aft.stop() to stop
function cb()
exists(tv) ? nothing : aft.stop()
if update_ids(Main)
set_items(tv, get_names_summaries(Main, nothing, (Module), true))
end
end
aft = tcl_after(1000, cb)
aft.start()
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 3005 |
# julia tk interface
# TODO:
# * callbacks (possibly via C wrapper)
# - portable event handling, probably using Tcl_CreateEventSource
# * types: may not make sense to have one for each widget, maybe one TkWidget
# * Cairo drawing surfaces
# - port cairo_surface_for to other platforms
# - expose constants from tcl.h like TCL_OK, TCL_ERROR, etc.
# - more widgets
# - state-interrogating functions
# - cleaning up unused callbacks
module Tk
using Tcl_jll
using Tk_jll
using Cairo
using Random
import Base: ==, bind, getindex, isequal, parent, setindex!, show, string, Text
import Graphics: width, height, getgc
import Cairo: destroy
include("tkwidget.jl") # old Tk
include("types.jl")
include("core.jl")
include("methods.jl")
include("widgets.jl")
include("containers.jl")
include("dialogs.jl")
include("menu.jl")
function __init__()
global tcl_interp[] = init()
global tk_version[] = VersionNumber(tcl_eval("return \$tk_version"))
tcl_eval("wm withdraw .")
tcl_eval("set auto_path")
## remove tearoff menus
tcl_eval("option add *tearOff 0")
global jl_tcl_callback_ptr = @cfunction(jl_tcl_callback,
Int32, (Ptr{Cvoid}, Ptr{Cvoid}, Int32, Ptr{Ptr{UInt8}}))
end
export Window, TkCanvas, Canvas, pack, place, tcl_eval, TclError,
cairo_surface_for, width, height, reveal, cairo_surface, getgc,
tcl_doevent, MouseHandler, draw
export tcl, tclvar, configure, cget, identify, state, instate, winfo, wm, exists,
tcl_after, bind, bindwheel, callback_add
export Tk_Widget, TTk_Widget, Tk_Container
export Toplevel, Frame, Labelframe, Notebook, Panedwindow
export Label, Button
export Checkbutton, Radio, Combobox
export Slider, Spinbox
export Entry, set_validation, Text
export Treeview, selected_nodes, node_insert, node_move, node_delete, node_open
export tree_headers, tree_column_widths, tree_key_header, tree_key_width
export Sizegrip, Separator, Progressbar, Image, Scrollbar
export Menu, menu_add, tk_popup
export GetOpenFile, GetSaveFile, ChooseDirectory, Messagebox
export pack, pack_configure, forget, pack_stop_propagate
export grid, grid_configure, grid_rowconfigure, grid_columnconfigure, grid_forget, grid_stop_propagate
export page_add, page_insert
export formlayout, scrollbars_add
export get_value, set_value,
get_items, set_items,
set_width,
set_height,
get_size, set_size,
pointerxy,
get_enabled, set_enabled,
get_editable, set_editable,
get_visible, set_visible,
set_position,
parent, toplevel, children,
raise, focus, update, destroy
@deprecate tk_bindwheel bindwheel
@deprecate tk_cget cget
@deprecate tk_configure configure
@deprecate tk_winfo winfo
@deprecate tk_wm wm
@deprecate tk_exists exists
@deprecate tk_bind bind
@deprecate tk_state state
@deprecate tk_instate instate
@deprecate get_width width
@deprecate get_height height
end # module
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 8608 | ## Types
mutable struct Tk_Toplevel <: TTk_Container w::TkWidget; children::Vector{Tk_Widget} end
mutable struct Tk_Frame <: TTk_Container w::TkWidget; children::Vector{Tk_Widget} end
mutable struct Tk_Labelframe <: TTk_Container w::TkWidget; children::Vector{Tk_Widget} end
mutable struct Tk_Notebook <: TTk_Container w::TkWidget; children::Vector{Tk_Widget} end
mutable struct Tk_Panedwindow <: TTk_Container w::TkWidget; children::Vector{Tk_Widget} end
==(a::TTk_Container, b::TTk_Container) = isequal(a.w, b.w) && typeof(a) == typeof(b)
## Toplevel window
function Toplevel(;title::AbstractString="Toplevel Window", width::Integer=200, height::Integer=200, visible::Bool=true)
w = Window(title, width, height, visible)
Tk_Toplevel(w, Tk_Widget[])
end
Toplevel(title::AbstractString, width::Integer, height::Integer, visible::Bool) = Toplevel(title=title, width=width, height=height, visible=visible)
Toplevel(title::AbstractString, width::Integer, height::Integer) = Toplevel(title=title, width=width, height=height)
Toplevel(title::AbstractString, visible::Bool) = Toplevel(title=title, visible=visible)
Toplevel(title::AbstractString) = Toplevel(title=title)
## Sizing of toplevel windows should refer to the geometry
width(widget::Tk_Toplevel) = parse(Int, winfo(widget, "width"))
height(widget::Tk_Toplevel) = parse(Int, winfo(widget, "height"))
get_size(widget::Tk_Toplevel) = [width(widget), height(widget)]
set_size(widget::Tk_Toplevel, width::Integer, height::Integer) = wm(widget, "geometry", "$(string(width))x$(string(height))")
set_size(widget::Tk_Toplevel, widthheight::Vector{T}) where {T <: Integer} = set_size(widget, widthheight[1], widthheight[2])
get_value(widget::Tk_Toplevel) = wm(widget, "title")
set_value(widget::Tk_Toplevel, value::AbstractString) = wm(widget, "title", value)
function set_visible(widget::Tk_Toplevel, value::Bool)
value = value ? "normal" : "withdrawn"
wm(widget, "state", value)
end
get_visible(widget::Tk_Toplevel) = wm(widget, "state") == "normal"
function get_visible(w::TkWidget)
if w.kind == "toplevel"
return wm(w, "state") == "normal"
else
return get_visible(w.parent)
end
end
## Set upper left corner of Toplevel to...
function set_position(widget::Tk_Toplevel, x::Integer, y::Integer)
p_or_m(x) = x < 0 ? "$x" : "+$x"
wm(widget, "geometry", I(p_or_m(x) * p_or_m(y)))
end
set_position(widget::Tk_Toplevel, pos::Vector{T}) where {T <: Integer} = set_position(w, pos[1], pos[2])
set_position(widget::Tk_Toplevel, pos::Tk_Widget) = set_position(widget, Integer[parse(Int, winfo(pos, i)) for i in ["x", "y"]] + [10,10])
update(widget::Tk_Toplevel) = wm(widget, "geometry")
destroy(widget::Tk_Toplevel) = tcl("destroy", widget)
## Frame
## nothing to add...
## Labelframe
Labelframe(parent::Widget, text::AbstractString) = Labelframe(parent, text=text)
get_value(widget::Tk_Labelframe) = cget(widget, "text")
set_value(widget::Tk_Labelframe, text::AbstractString) = configure(widget, Dict(:text=> text))
## Notebook
function page_add(child::Widget, label::AbstractString)
parent = winfo(child, "parent")
tcl(parent, "add", child, text = label)
end
function page_insert(child::Widget, index::Integer, label::AbstractString)
parent = winfo(child, "parent")
tcl(parent, "insert", index, child, text = label)
end
get_value(widget::Tk_Notebook) = 1 + parse(Int, tcl(widget, I"index current"))
set_value(widget::Tk_Notebook, index::Integer) = tcl(widget, "select", index - 1)
no_tabs(widget::Tk_Notebook) = length(split(tcl(widget, "tabs")))
## Panedwindow
## orient in "horizontal" or "vertical"
Panedwindow(widget::Widget, orient::AbstractString) = Panedwindow(widget, orient = orient)
function page_add(child::Widget, weight::Integer)
parent = winfo(child, "parent")
tcl(parent, "add", child, weight = weight)
end
## value is sash position as percentage of first pane
function get_value(widget::Tk_Panedwindow)
sz = (cget(widget, "orient") == "horizontal") ? width(widget) : height(widget)
pos = parse(Int, tcl(widget, "sashpos", 0))
floor(pos/sz*100)
end
## can set with Integer -- pixels, or real (proportion in [0,1])
set_value(widget::Tk_Panedwindow, value::Integer) = tcl(widget, "sashpos", 0, value)
function set_value(widget::Tk_Panedwindow, value::Real)
if value <= 1 && value >= 0
sz = (cget(widget, "orient") == "horizontal") ? width(widget) : height(widget)
set_value(widget, round(Int, value * sz/100))
end
end
page_add(child::Widget) = page_add(child, 1)
## Container methods
## pack(widget, {:expand => true, :anchor => "w"})
pack(widget::Widget; kwargs...) = tcl("pack", widget; kwargs...)
pack_configure(widget::Widget, kwargs...) = tcl(I"pack configure", widget; kwargs...)
pack_stop_propagate(widget::Widget) = tcl(I"pack propagate", widget, false)
## remove a page from display
function forget(widget::Widget)
manager = winfo(widget, "manager")
tcl(manager, "forget", widget)
end
function forget(parent::TTk_Container, child::Widget)
forget(child)
## remove from children
parent.children[:] = filter(x -> get_path(x) != get_path(child), parent.children)
end
## grid ...
IntOrRange = Union{Integer, UnitRange}
function grid(child::Widget, row::IntOrRange, column::IntOrRange; kwargs...)
path = get_path(child)
if isa(row, UnitRange) rowspan = 1 + maximum(row) - minimum(row) else rowspan = 1 end
if isa(column, UnitRange) columnspan = 1 + maximum(column) - minimum(column) else columnspan = 1 end
row = minimum(row) - 1
column = minimum(column) - 1
grid_configure(child, row=row, column=column, rowspan=rowspan, columnspan=columnspan; kwargs...)
end
grid_configure(child::Widget, args...; kwargs...) = tcl("grid", "configure", child, args...,; kwargs...)
grid_rowconfigure(parent::Widget, row::Integer; kwargs...) = tcl(I"grid rowconfigure", parent, row-1; kwargs... )
grid_columnconfigure(parent::Widget, column::Integer; kwargs...) = tcl(I"grid columnconfigure", parent, column-1; kwargs...)
grid_stop_propagate(parent::Widget) = tcl(I"grid propagate", parent, false)
grid_forget(child::Widget) = tcl(I"grid forget", child)
## Helper to layout two column with label using grid
##
## w = Toplevel()
## f = Frame(w); pack(f)
## sc = Slider(f, 1:10)
## e = Entry(f, "")
## b = Button(f, "click me", W -> println(map(get_value, (sc, e))))
## formlayout(sc, "Slider")
## formlayout(e, "Entry")
## formlayout(Separator(f), nothing)
## formlayout(b, nothing)
##
function formlayout(child::Tk_Widget, label::MaybeString)
master = winfo(child, "parent")
sz = map(x->parse(Int, x), split(tcl_eval("grid size $master"))) ## columns, rows
nrows = sz[2]
if isa(label, AbstractString)
l = Label(child.w.parent, label)
grid(l, nrows + 1, 1)
grid_configure(l, sticky = "ne")
end
grid(child, nrows + 1, 2)
grid_configure(child, sticky = "we", padx=5, pady=2)
grid_columnconfigure(master, 1, weight = 1)
end
## Wrap child in frame, return frame to pack (or grid) into parent of child
##
## w = Toplevel()
## f = Frame(w); pack(f) ## f shouldn't have any layout management of its children
## t = Text(f)
## scrollbars_add(f,t)
##
function scrollbars_add(parent::Tk_Frame, child::Tk_Widget)
grid_stop_propagate(parent)
xscr = Scrollbar(parent, child, "horizontal")
yscr = Scrollbar(parent, child, "vertical")
grid(child, 1, 1)
grid(yscr, 1, 2)
grid(xscr, 2, 1)
grid_configure(child, sticky = "news")
grid_configure(yscr, sticky = "ns")
grid_configure(xscr, sticky = "ew")
grid_rowconfigure(parent, 1, weight = 1)
grid_columnconfigure(parent, 1, weight = 1)
end
# Navigating hierarchies
# parent returns a TkWidget, because we don't know how to wrap it otherwise (?)
parent(w::TkWidget) = w.parent
parent(w::Tk_Widget) = parent(w.w)
parent(c::Canvas) = parent(c.c)
# For toplevel it's obvious how to wrap it...
function toplevel(w::Union{TkWidget, Tk_Widget, Canvas})
p = parent(w)
pold = p
while p !== nothing
pold = p
p = parent(p)
end
Tk_Toplevel(pold, Tk_Widget[])
end
toplevel(w::Tk_Toplevel) = w
## children
## @param ismapped::Bool. If true, will only return currently mapped children. (Forgotten children are dropped)
function children(w::TTk_Container; ismapped::Bool=false)
kids = w.children
if ismapped
ids = filter(u->winfo(u, "ismapped") == "1", split(winfo(w, "children")))
kids = filter(child -> contains(ids, get_path(child)), w.children)
end
kids
end
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 8147 | show(io::IO, widget::TkWidget) = print(io, typeof(widget))
show(io::IO, widget::Tk_Widget) = print(io, "Tk widget of type $(typeof(widget))")
tcl_add_path(path::AbstractString) = tcl_eval("lappend auto_path $path")
tcl_require(pkg::AbstractString) = tcl_eval("package require $pkg")
## helper to get path
## assumes Tk_Widgets have w property storing TkWidget
get_path(path::AbstractString) = path
get_path(widget::Tk_Widget) = get_path(widget.w)
get_path(widget::TkWidget) = get_path(widget.path)
get_path(widget::Canvas) = get_path(widget.c) # Tk.Canvas object
## Coversion of julia objects into tcl strings for inclusion via tcl() call
to_tcl(x) = string(x)
to_tcl(x::Nothing) = ""
has_space = r" "
to_tcl(x::AbstractString) = occursin(has_space, x) ? "{$x}" : x
mutable struct I x::MaybeString end # avoid wrapping in {} and ismatch call.
macro I_str(s) I(s) end
to_tcl(x::I) = x.x == nothing ? "" : x.x
to_tcl(x::Vector{T}) where {T <: Number} = "\"" * string(join(x, " ")) * "\""
function to_tcl(x::Vector{T}) where T <: AbstractString
tmp = join(["{$i}" for i in x], " ")
"[list $tmp ]"
end
to_tcl(x::Widget) = get_path(x)
function to_tcl(x::Dict)
out = filter( kv -> kv[2] != nothing, x)
join([" -$(string(k)) $(to_tcl(v))" for (k, v) in out], "")
end
function to_tcl(x::Function)
ccb = tcl_callback(x)
args = get_args(x)
perc_args = join(map(u -> "%$(string(u))", args[2:end]), " ")
cmd = "{$ccb $perc_args}"
end
function to_tcl(x::Tuple)
out = filter(item -> item != nothing, x)
"{"*join(["$(to_tcl(item))" for item in out], " ")*"}"
end
## Function to simplify call to tcl_eval, ala R's tcl() function
## converts argumets through to_tcl
function tcl(xs...; kwargs...)
cmd = join([" $(to_tcl(x)) " for x in xs], "")
cmd = cmd * join([" -$(string(k)) $(to_tcl(v)) " for (k, v) in kwargs], " ")
## println(cmd)
tcl_eval(cmd)
end
## escape a string
## http://stackoverflow.com/questions/5302120/general-string-quoting-for-tcl
## still need to escape \ (but not {})
function tk_string_escape(x::AbstractString)
tcl_eval("set stringescapevariable [subst -nocommands -novariables {$x}]")
"\$stringescapevariable"
end
## tclvar for textvariables
## Work with a text variable. Stores values as strings. Must coerce!
## getter -- THIS FAILS IN A CALLBACK!!!
#function tclvar(nm::AbstractString)
# cmd = "return \$::" * nm
# tcl(cmd)
#end
## setter
function tclvar(nm::AbstractString, value)
tcl("set", nm, value)
end
## create new variable with random name
function tclvar()
var = "tcl_" * randstring(10)
tclvar(var, "null")
var
end
## main configuration interface
function configure(widget::Widget, args...; kwargs...)
tcl(widget, "configure", args...; kwargs...)
end
setindex!(widget::Widget, value, prop::Symbol) = configure(widget, Dict(prop=>value))
## Get values
## cget
function cget(widget::Widget, prop::AbstractString, coerce::MaybeFunction)
out = tcl(widget, "cget", "-$prop")
isa(coerce, Function) ? coerce(out) : out
end
cget(widget::Widget, prop::AbstractString) = cget(widget, prop, nothing)
## convenience
getindex(widget::Widget, prop::Symbol) = cget(widget, string(prop))
## Identify widget at x,y
identify(widget::Widget, x::Integer, y::Integer) = tcl(widget, "identify", "%x", "%y")
## state(w, "!disabled")
state(widget::Widget, state::AbstractString) = tcl(widget, "state", state)
instate(widget::Widget, state::AbstractString) = tcl(widget, "instate", state) == "1" # return Bool
## tkwinfo
function winfo(widget::Widget, prop::AbstractString, coerce::MaybeFunction)
out = tcl("winfo", prop, widget)
isa(coerce, Function) ? coerce(out) : out
end
winfo(widget::Widget, prop::AbstractString) = winfo(widget, prop, nothing)
## wm.
wm(window::Widget, prop::AbstractString, args...; kwargs...) = tcl("wm", prop, window, args...; kwargs...)
_slots(m::Method) = (Base.uncompressed_ast(m).slotnames, m.nargs)
## Take a function, get its args as array of symbols. There must be better way...
## Helper functions for bind callback
function get_args(f::Function)
slots, n = _slots(first(methods(f)))
argnames = slots[1:n]
return _arg_offset == 0 ? argnames : argnames[_arg_offset:end]
end
_arg_offset = 0
_arg_offset = length(get_args(x->x))
## bind
## Function callbacks have first argument path that is ignored
## others match percent substitution
## e.g. (path, W, x, y) -> x will have W, x and y available through %W %x %y bindings
function bind(widget::Widget, event::AbstractString, callback::Function)
if event == "command"
configure(widget, command = callback)
else
path = get_path(widget)
## Need to grab percent subs from signature of function
ccb = Tk.tcl_callback(callback)
args = get_args(callback)
if length(args) == 0
error("Callback should have first argument of \"path\".")
end
## ala: "bind $path <ButtonPress-1> {$bp1cb %x %y}"
cmd = "bind $path $event {$ccb " * join(map(u -> "%$(string(u))", args[2:end]), " ") * "}"
tcl_eval(cmd)
end
end
bind(widget::Canvas, event::AbstractString, callback::Function) = bind(widget.c, event, callback)
## for use with do style
bind(callback::Function, widget::Union{Widget, Canvas}, event::AbstractString) = bind(widget, event, callback)
## Binding to mouse wheel
function bindwheel(widget::Widget, modifier::AbstractString, callback::Function, tkargs::AbstractString = "")
path = get_path(widget)
if !isempty(modifier) && !endswith(modifier,"-")
modifier = string(modifier, "-")
end
if !isempty(tkargs) && !startswith(tkargs," ")
tkargs = string(" ", tkargs)
end
ccb = tcl_callback(callback)
if Compat.Sys.islinux()
tcl_eval("bind $(path) <$(modifier)Button-4> {$ccb -120$tkargs}")
tcl_eval("bind $(path) <$(modifier)Button-5> {$ccb 120$tkargs}")
else
tcl_eval("bind $(path) <$(modifier)MouseWheel> {$ccb %D$tkargs}")
end
end
## add most typical callback
function callback_add(widget::Tk_Widget, callback::Function)
events = Dict(
:Tk_Window => "<Destroy>",
:Tk_Frame => nothing,
:Tk_Labelframe => nothing,
:Tk_Notebook => "<<NotebookTabChanged>>",
:Tk_Panedwindow => nothing,
##
:Tk_Label => nothing,
:Tk_Button => "command",
:Tk_Checkbutton => "command",
:Tk_Radio => "command",
:Tk_Combobox => "<<ComboboxSelected>>",
:Tk_Scale => "command",
:Tk_Spinbox => "command",
:Tk_Entry => "<FocusOut>",
:Tk_Text => "<FocusOut>",
:Tk_Treeview => "<<TreeviewSelect>>"
)
key = Base.Symbol(split(string(typeof(widget)), '.')[end])
if haskey(events, key)
event = events[key]
if event == nothing
return()
else
bind(widget, event, callback)
end
end
end
## Need this pattern to make a widget
## Parent is not a string, but TkWidget or Tk_Widget instance
function make_widget(parent::Widget, str::AbstractString; kwargs...)
path = isa(parent, Tk_Widget) ? parent.w : parent
w = TkWidget(path, str)
tcl(str, w; kwargs...)
w
end
## tcl after ...
## Better likely to use julia's
## timer = Base.Timer(next_frame)
## Base.start_timer(timer,int64(50),int64(50))
## create an object that will repeatedly call a
## function after a delay of ms milliseconds. This is started with
## obj.start() and stopped, if desired, with obj.stop(). To restart is
## possible, but first set obj.run=true.
mutable struct TclAfter
cb::Function
run::Bool
start::Union{Nothing, Function}
stop::Union{Nothing, Function}
ms::Int
function TclAfter(ms, cb::Function)
obj = new(cb, true, nothing, nothing, ms)
function fun(path)
cb()
if obj.run
Tk.tcl("after", obj.ms, fun)
end
end
obj.start = () -> Tk.tcl("after", obj.ms, fun)
obj.stop = () -> obj.run = false
obj
end
end
tcl_after(ms::Integer, cb::Function) = TclAfter(ms, cb)
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 935 | ## dialogs
## can add arguments if desired. Don't like names or lack of arguments
GetOpenFile(;kwargs...) = tcl("tk_getOpenFile";kwargs...)
GetSaveFile(;kwargs...) = tcl("tk_getSaveFile";kwargs...)
ChooseDirectory(;kwargs...) = tcl("tk_chooseDirectory";kwargs...)
## Message box
function Messagebox(parent::MaybeWidget; title::AbstractString="", message::AbstractString="", detail::AbstractString="")
args = Dict()
if !isa(parent, Nothing) args["parent"] = get_path(parent) end
if length(title) > 0 args["title"] = title end
if length(message) > 0 args["message"] = message end
if length(detail) > 0 args["detail"] = detail end
args["type"] = "okcancel"
tcl("tk_messageBox", args)
end
Messagebox(;kwargs...) = Messagebox(nothing; kwargs...)
Messagebox(parent::Widget, message::AbstractString) = Messagebox(parent, message=message)
Messagebox(message::AbstractString) = Message(nothing, message=message)
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 2417 |
## make a menubar
## w = Toplevel()
## mb = Menu(w) ## adds to toplevel too when w is Toplevel
## file_menu = menu_add(mb, "File...") ## make top level entry
## menu_add(file_menu, "title", w -> println("hi")) ## pass function to make action item
## menu_add(file_menu, Separator(w)) ## a separator
## menu_add(file_menu, Checkbutton(w, "label")) ## A checkbutton
## menu_add(file_menu, Radio(w, ["one", "two"])) ## A checkbutton
## create menu, add to window
function Menu(widget::Tk_Toplevel)
m = Menu(widget.w) # dispatch down
configure(widget, menu = m)
m
end
## add a submenu, return it
function menu_add(widget::Tk_Menu, label::AbstractString)
m = Menu(widget)
tcl(widget, "add", "cascade", menu = m, label = label)
m
end
## add menu item to menu
function menu_add(widget::Tk_Menu, label::AbstractString, command::Function, img::Tk_Image)
tcl(widget, "add", "command", label = label, command = command, image = img, compound = "left")
end
function menu_add(widget::Tk_Menu, label::AbstractString, command::Function)
ccb = Tk.tcl_callback(command)
tcl(widget, "add", "command", label = label, command = command)
end
function menu_add(widget::Tk_Menu, sep::Tk_Separator)
tcl(widget, "add", "separator")
end
function menu_add(widget::Tk_Menu, cb::Tk_Checkbutton)
## no ! here, as state has changed by the time we get this
tcl(widget, "add", "checkbutton", label = get_items(cb), variable = cb[:variable])
end
function menu_add(widget::Tk_Menu, rb::Tk_Radio)
var = cget(rb.buttons[1], "variable")
items = get_items(rb)
for i in 1:length(items)
tcl(widget, "add", "radiobutton", label = items[i], value = items[i],
variable = var)
end
end
function tk_popup(widget::Tk_Widget, menu::Tk_Menu)
if Compat.Sys.isapple()
tcl_eval("bind $(widget.w.path) <2> {tk_popup $(menu.w.path) %X %Y}")
tcl_eval("bind $(widget.w.path) <Control-1> {tk_popup $(menu.w.path) %X %Y}")
else
tcl_eval("bind $(widget.w.path) <3> {tk_popup $(menu.w.path) %X %Y}")
end
end
function tk_popup(c::Canvas, menu::Tk_Menu)
if Compat.Sys.isapple()
tcl_eval("bind $(c.c.path) <2> {tk_popup $(menu.w.path) %X %Y}")
tcl_eval("bind $(c.c.path) <Control-1> {tk_popup $(menu.w.path) %X %Y}")
else
tcl_eval("bind $(c.c.path) <3> {tk_popup $(menu.w.path) %X %Y}")
end
end
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 2710 | ## Additional methods to give simplified interface to the Tk widgets created in this package
XXX() = error("No default method.")
## Main value
get_value(widget::Widget) = XXX()
set_value(widget::Widget, value) = XXX()
## items to select from
get_items(widget::Widget) = XXX()
set_items(widget::Widget, items) = XXX()
## size of widgets have three possible values:
## geometry -- actual size when drawn (winfo info)
## reqwidth -- may not be satisfied by window sizing algorithm.
## that reported by -width property
## width, height, get_size refer to that drawn:
width(widget::Widget) = round(Int, float(winfo(widget, "width")))
height(widget::Widget) = round(Int, float(winfo(widget, "height")))
get_size(widget::Widget) = [width(widget), height(widget)]
## setting is different.
## Toplevel windows are set by geometry and wm
## Other widgets *may* have a -width, -height property for setting a requested width and height that gets set
## may or may not be in pixels
## as getting and setting would be different, we skip the setting part
## a user can set the requested size with w[:width] = width, or w[:height] = height.
## (Or for sliders, w[:length] = width_or_height
## Changing the requested width will usually cause the geometry to recompute
## to force this, one has wm(toplevel, "geometry", "{}")
set_size(widget::Widget, args...) = XXX()
## sensitive to user input
get_enabled(widget::Widget) = XXX()
get_enabled(widget::TTk_Widget) = instate(widget, "!disabled")
set_enabled(widget::Widget, value::Bool) = XXX()
set_enabled(widget::TTk_Widget, value::Bool) = widget[:state] = value ? "!disabled" : "disabled"
## can be edited
get_editable(widget::Widget) = XXX()
get_editable(widget::TTk_Widget) = instate(widget, "!readonly")
set_editable(widget::Widget, value::Bool) = XXX()
set_editable(widget::TTk_Widget, value::Bool) = widget[:state] = value ? "!readonly" : "readonly"
## hide/show widget
get_visible(widget::Widget) = XXX()
set_visible(widget::Widget, value::Bool) = XXX()
## set focus
focus(widget::Widget) = tcl("focus", widget)
raise(widget::Widget) = tcl("raise", widget)
## does widget exist?
exists(widget::Widget) = winfo(widget, "exists") == "1"
## Determine the position of the mouse pointer within the window.
# Returns -1,-1 when the window is not on the screen (e.g., the active desktop).
function pointerxy(window)
# Get position within the screen
xy = split(winfo(window, "pointerxy"))
x,y = parse(Int, xy[1]), parse(Int, xy[2])
if x == -1 && y == -1
return x,y # not on same desktop
end
# Compensate for window position
winx = parse(Int, winfo(window, "x"))
winy = parse(Int, winfo(window, "y"))
x-winx, y-winy
end
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 15480 | const TCL_OK = convert(Int32, 0)
const TCL_ERROR = convert(Int32, 1)
const TCL_RETURN = convert(Int32, 2)
const TCL_BREAK = convert(Int32, 3)
const TCL_CONTINUE = convert(Int32, 4)
const TCL_VOLATILE = convert(Ptr{Cvoid}, 1)
const TCL_STATIC = convert(Ptr{Cvoid}, 0)
const TCL_DYNAMIC = convert(Ptr{Cvoid}, 3)
tcl_doevent() = tcl_doevent(nothing,0)
function tcl_doevent(timer,status=0)
# https://www.tcl.tk/man/tcl8.6/TclLib/DoOneEvent.htm
# DONT_WAIT* = 1 shl 1
# WINDOW_EVENTS* = 1 shl 2
# FILE_EVENTS* = 1 shl 3
# TIMER_EVENTS* = 1 shl 4
# IDLE_EVENTS* = 1 shl 5
# ALL_EVENTS* = not DONT_WAIT
while (ccall((:Tcl_DoOneEvent,libtcl), Int32, (Int32,), (1<<1))!=0)
end
end
global timeout = nothing
# fetch first word from struct
tk_display(w) = pointer_to_array(convert(Ptr{Ptr{Cvoid}},w), (1,), false)[1]
function init()
ccall((:Tcl_FindExecutable,libtcl), Cvoid, (Ptr{UInt8},),
joinpath(Sys.BINDIR, "julia"))
ccall((:g_type_init,Cairo.libgobject),Cvoid,())
tclinterp = ccall((:Tcl_CreateInterp,libtcl), Ptr{Cvoid}, ())
libpath = IOBuffer()
print(libpath,"set env(TCL_LIBRARY) [subst -nocommands -novariables {")
escape_string(libpath, joinpath(dirname(dirname(Tcl_jll.libtcl_path)), "lib", "tcl8.6"), "{}")
print(libpath,"}]")
tcl_eval(String(take!(libpath)),tclinterp)
print(libpath,"set env(TK_LIBRARY) [subst -nocommands -novariables {")
escape_string(libpath, joinpath(dirname(dirname(Tk_jll.libtk_path)), "lib", "tk8.6"), "{}")
print(libpath,"}]")
tcl_eval(String(take!(libpath)),tclinterp)
if ccall((:Tcl_Init,libtcl), Int32, (Ptr{Cvoid},), tclinterp) == TCL_ERROR
throw(TclError(string("error initializing Tcl: ", tcl_result(tclinterp))))
end
if ccall((:Tk_Init,libtk), Int32, (Ptr{Cvoid},), tclinterp) == TCL_ERROR
throw(TclError(string("error initializing Tk: ", tcl_result(tclinterp))))
end
global timeout
@static if VERSION >= v"0.7.0-DEV.3526"
timeout = Timer(tcl_doevent, 0.1, interval=0.01)
else
timeout = Timer(tcl_doevent, 0.1, 0.01)
end
tclinterp
end
mainwindow(interp) =
ccall((:Tk_MainWindow,libtk), Ptr{Cvoid}, (Ptr{Cvoid},), interp)
mainwindow() = mainwindow(tcl_interp[])
mutable struct TclError <: Exception
msg::AbstractString
end
tcl_result() = tcl_result(tcl_interp[])
function tcl_result(tclinterp)
unsafe_string(ccall((:Tcl_GetStringResult,libtcl),
Ptr{UInt8}, (Ptr{Cvoid},), tclinterp))
end
function tcl_evalfile(name)
if ccall((:Tcl_EvalFile,libtcl), Int32, (Ptr{Cvoid}, Ptr{UInt8}),
tcl_interp[], name) != 0
throw(TclError(tcl_result()))
end
nothing
end
tcl_eval(cmd) = tcl_eval(cmd,tcl_interp[])
function tcl_eval(cmd,tclinterp)
#@show cmd
code = ccall((:Tcl_Eval,libtcl), Int32, (Ptr{Cvoid}, Ptr{UInt8}),
tclinterp, cmd)
result = tcl_result(tclinterp)
if code != 0
throw(TclError(result))
else
result
end
end
mutable struct TkWidget
path::String
kind::String
parent::Union{TkWidget,Nothing}
let ID::Int = 0
function TkWidget(parent::TkWidget, kind)
underscoredKind = replace(kind, "::" => "_")
path = "$(parent.path).jl_$(underscoredKind)$(ID)"; ID += 1
new(path, kind, parent)
end
global Window
function Window(title, w, h, visible = true)
wpath = ".jl_win$ID"; ID += 1
tcl_eval("toplevel $wpath -width $w -height $h -background \"\"")
if !visible
tcl_eval("wm withdraw $wpath")
end
tcl_eval("wm title $wpath \"$title\"")
tcl_doevent()
new(wpath, "toplevel", nothing)
end
end
end
Window(title) = Window(title, 200, 200)
place(widget::TkWidget, x::Int, y::Int) = tcl_eval("place $(widget.path) -x $x -y $y")
function nametowindow(name)
ccall((:Tk_NameToWindow,libtk), Ptr{Cvoid},
(Ptr{Cvoid}, Ptr{UInt8}, Ptr{Cvoid}),
tcl_interp[], name, mainwindow(tcl_interp[]))
end
const _callbacks = Dict{String, Any}()
const empty_str = ""
function jl_tcl_callback(fptr, interp, argc::Int32, argv::Ptr{Ptr{UInt8}})::Int32
cname = unsafe_pointer_to_objref(fptr)
f=_callbacks[cname]
args = [unsafe_string(unsafe_load(argv,i)) for i=1:argc]
local result
try
result = f(args...)
catch e
println("error during Tk callback: ")
Base.display_error(e,catch_backtrace())
return TCL_ERROR
end
if isa(result,String)
ccall((:Tcl_SetResult,libtcl), Cvoid, (Ptr{Cvoid}, Ptr{UInt8}, Int32),
interp, result, TCL_VOLATILE)
else
ccall((:Tcl_SetResult,libtcl), Cvoid, (Ptr{Cvoid}, Ptr{UInt8}, Int32),
interp, empty_str, TCL_STATIC)
end
return TCL_OK
end
function tcl_callback(f)
cname = string("jl_cb", repr(objectid(f)))
# TODO: use Tcl_CreateObjCommand instead
ccall((:Tcl_CreateCommand,libtcl), Ptr{Cvoid},
(Ptr{Cvoid}, Ptr{UInt8}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
tcl_interp[], cname, jl_tcl_callback_ptr, pointer_from_objref(cname), C_NULL)
# TODO: use a delete proc (last arg) to remove this
_callbacks[cname] = f
cname
end
width(w::TkWidget) = parse(Int, tcl_eval("winfo width $(w.path)"))
height(w::TkWidget) = parse(Int, tcl_eval("winfo height $(w.path)"))
const default_mouse_cb = (w, x, y)->nothing
mutable struct MouseHandler
button1press
button1release
button2press
button2release
button3press
button3release
motion
button1motion
MouseHandler() = new(default_mouse_cb, default_mouse_cb, default_mouse_cb,
default_mouse_cb, default_mouse_cb, default_mouse_cb,
default_mouse_cb, default_mouse_cb)
end
# TkCanvas is the plain Tk canvas widget. This one is double-buffered
# and built on Cairo.
mutable struct Canvas
c::TkWidget
back::CairoSurface # backing store
backcc::CairoContext
mouse::MouseHandler
draw
resize
initialized::Bool
Canvas(parent) = Canvas(parent, -1, -1)
function Canvas(parent, w, h)
c = TkWidget(parent, "ttk::frame")
# frame supports empty background, allowing us to control drawing
if w < 0
w = width(parent)
end
if h < 0
h = height(parent)
end
this = new(c)
tcl_eval("frame $(c.path) -width $w -height $h -background \"\"")
this.draw = x->nothing
this.resize = x->nothing
this.mouse = MouseHandler()
this.initialized = false
add_canvas_callbacks(this)
this
end
end
width(c::Canvas) = width(c.c)
height(c::Canvas) = height(c.c)
function configure(c::Canvas)
# this is called e.g. on window resize
if isdefined(c,:back)
Cairo.destroy(c.backcc)
Cairo.destroy(c.back)
end
render_to_cairo(c.c, false) do surf
w = width(c.c)
h = height(c.c)
c.back = surface_create_similar(surf, w, h)
end
c.backcc = CairoContext(c.back)
# Check c.initialized to prevent infinite recursion if initialized from
# c.resize. This also avoids a double-redraw on the first call.
if c.initialized
c.resize(c)
draw(c)
end
end
function draw(c::Canvas)
c.draw(c)
reveal(c)
end
function reveal(c::Canvas)
render_to_cairo(c.c) do front
frontcc = CairoContext(front)
back = cairo_surface(c)
set_source_surface(frontcc, back, 0, 0)
paint(frontcc)
destroy(frontcc)
end
tcl_doevent()
end
@static if Sys.isapple()
if Sys.WORD_SIZE == 32
const CGFloat = Float32
else
const CGFloat = Float64
end
function objc_msgSend(id, uid, ::Type{T}=Ptr{Void}) where T
convert(T, ccall(:objc_msgSend, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}),
id, ccall(:sel_getUid, Ptr{Cvoid}, (Ptr{UInt8},), uid)))
end
end
# NOTE: This has to be ported to each window environment.
# But, this should be the only such function needed.
function render_to_cairo(f::Function, w::TkWidget, clipped::Bool=true)
win = nametowindow(w.path)
win == C_NULL && error("invalid window")
@static if Sys.islinux()
disp = jl_tkwin_display(win)
d = jl_tkwin_id(win)
vis = jl_tkwin_visual(win)
if disp==C_NULL || d==0 || vis==C_NULL
error("invalid window")
end
surf = CairoXlibSurface(disp, d, vis, width(w), height(w))
f(surf)
destroy(surf)
return
end
@static if Sys.isapple()
## TkMacOSXSetupDrawingContext()
drawable = jl_tkwin_id(win)
view = ccall((:TkMacOSXGetRootControl,libtk), Ptr{Cvoid}, (Int,), drawable) # NSView*
if view == C_NULL
error("Invalid OS X window at getView")
end
focusView = objc_msgSend(ccall(:objc_getClass, Ptr{Cvoid}, (Ptr{UInt8},), "NSView"), "focusView");
focusLocked = false
if view != focusView
focusLocked = objc_msgSend(view, "lockFocusIfCanDraw", Int32) != 0
dontDraw = !focusLocked
else
dontDraw = 0 == objc_msgSend(view, "canDraw", Int32)
end
if dontDraw
error("Cannot draw to OS X Window")
end
window = objc_msgSend(view, "window")
objc_msgSend(window, "disableFlushWindow")
context = objc_msgSend(objc_msgSend(window, "graphicsContext"), "graphicsPort")
if !focusLocked
ccall(:CGContextSaveGState, Cvoid, (Ptr{Cvoid},), context)
end
try
## TkMacOSXGetClipRgn
wi, hi = width(w), height(w)
if clipped
macDraw = unsafe_load(convert(Ptr{TkWindowPrivate}, drawable))
if macDraw.winPtr != C_NULL
TK_CLIP_INVALID = 0x02 # 8.4, 8.5, 8.6
if macDraw.flags & TK_CLIP_INVALID != 0
ccall((:TkMacOSXUpdateClipRgn,libtk), Cvoid, (Ptr{Cvoid},), macDraw.winPtr)
macDraw = unsafe_load(convert(Ptr{TkWindowPrivate}, drawable))
end
clipRgn = if macDraw.drawRgn != C_NULL
macDraw.drawRgn
elseif macDraw.visRgn != C_NULL
macDraw.visRgn
else
C_NULL
end
end
##
ccall(:CGContextTranslateCTM, Cvoid, (Ptr{Cvoid}, CGFloat, CGFloat), context, 0, height(toplevel(w)))
ccall(:CGContextScaleCTM, Cvoid, (Ptr{Cvoid}, CGFloat, CGFloat), context, 1, -1)
if clipRgn != C_NULL
if ccall(:HIShapeIsEmpty, UInt8, (Ptr{Cvoid},), clipRgn) != 0
return
end
@assert 0 == ccall(:HIShapeReplacePathInCGContext, Cint, (Ptr{Cvoid}, Ptr{Cvoid}), clipRgn, context)
ccall(:CGContextEOClip, Cvoid, (Ptr{Cvoid},), context)
end
ccall(:CGContextTranslateCTM, Cvoid, (Ptr{Cvoid}, CGFloat, CGFloat), context, macDraw.xOff, macDraw.yOff)
##
end
surf = CairoQuartzSurface(context, wi, hi)
try
f(surf)
finally
destroy(surf)
end
finally
## TkMacOSXRestoreDrawingContext
ccall(:CGContextSynchronize, Cvoid, (Ptr{Cvoid},), context)
objc_msgSend(window, "enableFlushWindow")
if focusLocked
objc_msgSend(view, "unlockFocus")
else
ccall(:CGContextRestoreGState, Cvoid, (Ptr{Cvoid},), context)
end
end
##
return
end
@static if Sys.iswindows()
state = Vector{UInt8}(sizeof(Int)*2) # 8.4, 8.5, 8.6
drawable = jl_tkwin_id(win)
hdc = ccall((:TkWinGetDrawableDC,libtk), Ptr{Cvoid}, (Ptr{Cvoid}, Int, Ptr{UInt8}),
jl_tkwin_display(win), drawable, state)
surf = CairoWin32Surface(hdc, width(w), height(w))
f(surf)
destroy(surf)
ccall((:TkWinReleaseDrawableDC,libtk), Cvoid, (Int, Int, Ptr{UInt8}),
drawable, hdc, state)
return
end
error("Unsupported Operating System")
end
function add_canvas_callbacks(c::Canvas)
# See Table 15-3 of http://oreilly.com/catalog/mastperltk/chapter/ch15.html
# A widget has been mapped onto the display and is visible
bind(c, "<Map>", path -> init_canvas(c))
# All or part of a widget has been uncovered and may need to be redrawn
bind(c, "<Expose>", path -> reveal(c))
# A widget has changed size or position and may need to adjust its layout
bind(c, "<Configure>", path -> configure(c))
# A mouse button was pressed
bind(c, "<ButtonPress-1>", (path,x,y)->(c.mouse.button1press(c, parse(Int, x), parse(Int, y))))
bind(c, "<ButtonRelease-1>", (path,x,y)->(c.mouse.button1release(c, parse(Int, x), parse(Int, y))))
bind(c, "<ButtonPress-2>", (path,x,y)->(c.mouse.button2press(c, parse(Int, x), parse(Int, y))))
bind(c, "<ButtonRelease-2>", (path,x,y)->(c.mouse.button2release(c, parse(Int, x), parse(Int, y))))
bind(c, "<ButtonPress-3>", (path,x,y)->(c.mouse.button3press(c, parse(Int, x), parse(Int, y))))
bind(c, "<ButtonRelease-3>", (path,x,y)->(c.mouse.button3release(c, parse(Int, x), parse(Int, y))))
# The cursor is in motion over a widget
bind(c, "<Motion>", (path,x,y)->(c.mouse.motion(c, parse(Int, x), parse(Int, y))))
bind(c, "<Button1-Motion>", (path,x,y)->(c.mouse.button1motion(c, parse(Int, x), parse(Int, y))))
end
# some canvas init steps require the widget to fully exist
# this is called once per Canvas, before doing anything else with it
function init_canvas(c::Canvas)
c.initialized = true
configure(c)
c
end
get_visible(c::Canvas) = get_visible(c.c.parent)
initialized(c::Canvas) = c.initialized
function pack(c::Canvas, args...)
pack(c.c, args...)
end
function grid(c::Canvas, args...)
grid(c.c, args...)
end
function place(c::Canvas, x::Int, y::Int)
place(c.c, x, y)
end
function update()
tcl_eval("update")
end
function wait_initialized(c::Canvas)
n = 0
while !initialized(c)
tcl_doevent()
n += 1
if n > 10000
error("getgc: Canvas is not drawable")
end
end
end
function getgc(c::Canvas)
wait_initialized(c)
c.backcc
end
function cairo_surface(c::Canvas)
wait_initialized(c)
c.back
end
@static if Sys.isapple()
struct TkWindowPrivate
winPtr::Ptr{Cvoid}
view::Ptr{Cvoid}
context::Ptr{Cvoid}
xOff::Cint
yOff::Cint
sizeX::CGFloat
sizeY::CGFloat
visRgn::Ptr{Cvoid}
aboveVisRgn::Ptr{Cvoid}
drawRgn::Ptr{Cvoid}
referenceCount::Ptr{Cvoid}
toplevel::Ptr{Cvoid}
flags::Cint
end
end
global tcl_interp = Ref{Ptr{Cvoid}}()
global tk_version = Ref{VersionNumber}()
jl_tkwin_display(tkwin::Ptr{Cvoid}) = unsafe_load(convert(Ptr{Ptr{Cvoid}},tkwin), 1) # 8.4, 8.5, 8.6
jl_tkwin_visual(tkwin::Ptr{Cvoid}) = unsafe_load(convert(Ptr{Ptr{Cvoid}},tkwin), 4) # 8.4, 8.5, 8.6
jl_tkwin_id(tkwin::Ptr{Cvoid}) = unsafe_load(convert(Ptr{Int},tkwin), 6) # 8.4, 8.5, 8.6
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 735 | ## Abstract types
abstract type Tk_Widget end
abstract type TTk_Widget <: Tk_Widget end ## for ttk::widgets
abstract type TTk_Container <: Tk_Widget end ## for containers (frame, labelframe, ???)
const Widget = Union{TkWidget, Tk_Widget, Canvas, AbstractString}
## Maybe -- can this be parameterized?
## https://groups.google.com/forum/?fromgroups=#!topic/julia-dev/IbbWwplrqlc (takeaway -- this style is frowned upon)
const MaybeFunction = Union{Function, Nothing}
const MaybeString = Union{AbstractString, Nothing}
const MaybeStringInteger = Union{AbstractString, Integer, Nothing} # for at in tree insert
const MaybeVector = Union{Vector, Nothing}
const MaybeWidget = Union{Widget, Nothing}
const MaybeBool = Union{Bool, Nothing}
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 23884 | ## Create basic widgets here
## Most structs are simple, some have other properties
mutable struct Tk_Label <: TTk_Widget w::TkWidget end
mutable struct Tk_Button <: TTk_Widget w::TkWidget end
mutable struct Tk_Checkbutton <: TTk_Widget w::TkWidget end
##struct Tk_Radio <: TTk_Widget w::TkWidget end
##struct Tk_Combobox <: TTk_Widget w::TkWidget end
mutable struct Tk_Scale <: TTk_Widget w::TkWidget end
#struct Tk_Spinbox <: TTk_Widget w::TkWidget end
mutable struct Tk_Entry <: TTk_Widget w::TkWidget end
mutable struct Tk_Sizegrip <: TTk_Widget w::TkWidget end
mutable struct Tk_Separator <: TTk_Widget w::TkWidget end
mutable struct Tk_Progressbar <: TTk_Widget w::TkWidget end
mutable struct Tk_Menu <: TTk_Widget w::TkWidget end
mutable struct Tk_Menubutton <: TTk_Widget w::TkWidget end
mutable struct Tk_Image <: TTk_Widget w::AbstractString end
mutable struct Tk_Scrollbar <: TTk_Widget w::TkWidget end
mutable struct Tk_Text <: Tk_Widget w::TkWidget end
##struct Tk_Treeview <: Tk_Widget w::TkWidget end
mutable struct Tk_Canvas <: Tk_Widget w::TkWidget end
for (k, k1, v) in ((:Label, :Tk_Label, "ttk::label"),
(:Button, :Tk_Button, "ttk::button"),
(:Checkbutton, :Tk_Checkbutton, "ttk::checkbutton"),
(:Radiobutton, :Tk_Radiobutton, "ttk::radiobutton"),
(:Combobox, :Tk_Combobox, "ttk::combobox"),
(:Slider, :Tk_Scale, "ttk::scale"), # Scale conflicts with Gadfly.Scale
(:Spinbox, :Tk_Spinbox, "ttk::spinbox"),
(:Entry, :Tk_Entry, "ttk::entry"),
(:Sizegrip, :Tk_Sizegrip, "ttk::sizegrip"),
(:Separator, :Tk_Separator, "ttk::separator"),
(:Progressbar, :Tk_Progressbar, "ttk::progressbar"),
(:Menu, :Tk_Menu, "menu"),
(:Menubutton, :Tk_Menubutton, "ttk::menubutton"),
(:Scrollbar, :Tk_Scrollbar, "ttk::scrollbar"),
(:Text, :Tk_Text, "text"),
(:Treeview, :Tk_Treeview, "ttk::treeview"),
(:TkCanvas, :Tk_Canvas, "canvas"),
##
(:Frame, :Tk_Frame, "ttk::frame"),
(:Labelframe, :Tk_Labelframe, "ttk::labelframe"),
(:Notebook, :Tk_Notebook, "ttk::notebook"),
(:Panedwindow, :Tk_Panedwindow, "ttk::panedwindow")
)
@eval begin
function $k(parent::Widget; kwargs...)
w = make_widget(parent, $v; kwargs...)
widget = $k1 <: TTk_Container ? $k1(w, Tk_Widget[]) : $k1(w)
if isa(parent, TTk_Container) push!(parent.children, widget) end
widget
end
end
end
## Now customize
## Label constructors
Label(parent::Widget, text::AbstractString, image::Tk_Image) = Label(parent, text=tk_string_escape(text), image=image, compound="left")
Label(parent::Widget, text::AbstractString) = Label(parent, text=tk_string_escape(text))
Label(parent::Widget, image::Tk_Image) = Label(parent, image=image, compound="image")
get_value(widget::Union{Tk_Button, Tk_Label}) = widget[:text]
function set_value(widget::Union{Tk_Label, Tk_Button}, value::AbstractString)
variable = cget(widget, "textvariable")
(variable == "") ? widget[:text] = tk_string_escape(value) : tclvar(variable, value)
end
## Button constructors
Button(parent::Widget, text::AbstractString, command::Function, image::Tk_Image) =
Button(parent, text = tk_string_escape(text), command=command, image=image, compound="left")
Button(parent::Widget, text::AbstractString, image::Tk_Image) =
Button(parent, text = tk_string_escape(text), image=image, compound="left")
Button(parent::Widget, text::AbstractString, command::Function) = Button(parent, text=tk_string_escape(text), command=command)
Button(parent::Widget, text::AbstractString) = Button(parent, text=tk_string_escape(text))
Button(parent::Widget, command::Function, image::Tk_Image) =
Button(parent, command=command, image=image, compound="image")
Button(parent::Widget, image::Tk_Image) =
Button(parent, image=image, compound="image")
## checkbox
function Checkbutton(parent::Widget, label::AbstractString)
cb = Checkbutton(parent)
set_items(cb, label)
cb[:variable] = tclvar()
set_value(cb, false)
cb
end
function get_value(widget::Tk_Checkbutton)
instate(widget, "selected")
end
function set_value(widget::Tk_Checkbutton, value::Bool)
var = widget[:variable]
tclvar(var, value ? 1 : 0)
end
get_items(widget::Tk_Checkbutton) = widget[:text]
set_items(widget::Tk_Checkbutton, value::AbstractString) = widget[:text] = tk_string_escape(value)
## RadioButton
mutable struct Tk_Radiobutton <: TTk_Widget
w::TkWidget
end
MaybeTkRadioButton = Union{Nothing, Tk_Radiobutton}
function Radiobutton(parent::Widget, group::MaybeTkRadioButton, label::AbstractString)
rb = Radiobutton(parent)
var = isa(group, Tk_Radiobutton) ? group[:variable] : tclvar()
configure(rb, variable = var, text=label, value=label)
rb
end
Radiobutton(parent::Widget, label::AbstractString) = Radiobutton(parent, nothing, label)
get_value(widget::Tk_Radiobutton) = instate(widget, "selected")
set_value(widget::Tk_Radiobutton, value::Bool) = state(value ? "selected" : "!selected")
get_items(widget::Tk_Radiobutton) = widget[:text]
set_items(widget::Tk_Radiobutton, value::AbstractString) = configure(widget, text = value, value=value)
## Radio Button Group
mutable struct Tk_Radio <: TTk_Widget
w::TkWidget
buttons::Vector
orient::Union{Nothing, AbstractString}
end
function Radio(parent::Widget, labels::Vector{T}, orient::AbstractString) where {T<:AbstractString}
n = size(labels)[1]
rbs = Vector{Tk_Radiobutton}(undef, n)
frame = Frame(parent)
rbs[1] = Radiobutton(frame, tk_string_escape(labels[1]))
if n > 1
for j in 2:n
rbs[j] = Radiobutton(frame, rbs[1], tk_string_escape(labels[j]))
end
end
rb = Tk_Radio(frame.w, rbs, orient)
set_value(rb, labels[1])
map(u -> pack(u, side = orient == "horizontal" ? "left" : "top",
anchor = orient == "horizontal" ? "n" : "w"), rbs)
rb
end
Radio(parent::Widget, labels::Vector{T}) where {T <: AbstractString} = Radio(parent, labels, "vertical") ## vertical default
function get_value(widget::Tk_Radio)
items = get_items(widget)
sel = map(get_value, widget.buttons)
items[sel][1]
end
function set_value(widget::Tk_Radio, value::AbstractString)
var = cget(widget.buttons[1], "variable")
tclvar(var, value)
end
function set_value(widget::Tk_Radio, value::Integer)
items = get_items(widget)
set_value(widget, items[value])
end
get_items(widget::Tk_Radio) = map(get_items, widget.buttons)
function bind(widget::Tk_Radio, event::AbstractString, callback::Function)
## put onto each, but W now refers to button -- not group of buttons
map(u -> bind(u, event, callback), widget.buttons)
end
## return ith button
## remove this until we split off a version for newer julia's.
##getindex(widget::Tk_Radio, i::Integer) = widget.buttons[i]
## Combobox
mutable struct Tk_Combobox <: TTk_Widget
w::TkWidget
values::Vector # of tuples (key, label)
Tk_Combobox(w::TkWidget) = new(w, [])
end
## Combobox.
## One can specify the values different ways
## * as a vector of strings
## * as a vector of (key,value) tuples. The value is displayed, keys are used by get_value, set_value
## This has the advantage of keeping order.
## * as a dict of (key,value) pairs. This must be specified through set_items though
function Combobox(parent::Widget, values::Vector)
cb = Combobox(parent)
set_items(cb, values)
set_editable(cb, false)
cb
end
cb_pluck_labels(t) = AbstractString[v for (k,v) in t]
cb_pluck_keys(t) = AbstractString[k for (k,v) in t]
function get_value(widget::Tk_Combobox)
label = tcl(widget, "get")
if get_editable(widget) return(label) end
## okay look up in vector or tuples
labels = cb_pluck_labels(widget.values)
keys = cb_pluck_keys(widget.values)
out = keys[label .== labels]
length(out) == 0 ? nothing : out[1]
end
set_value(widget::Tk_Combobox, index::Integer) = set_value(widget, cb_pluck_labels(widget.values)[index])
## value is a key
function set_value(widget::Tk_Combobox, value::MaybeString)
if value == nothing tcl(widget, "set", "{}"); return end
if get_editable(widget)
tcl(widget, "set", value)
else
keys = cb_pluck_keys(widget.values)
labels = cb_pluck_labels(widget.values)
if any(value .== keys) tcl(widget, "set", labels[value .== keys][1]) end
end
end
get_items(widget::Tk_Combobox) = widget.values
function set_items(widget::Tk_Combobox, items::Vector{Tuple{T,T}}) where T
vals = cb_pluck_labels(items)
configure(widget, values = vals)
widget.values = items
end
function set_items(widget::Tk_Combobox, items::Dict)
widget.values = [(string(k),v) for (k,v) in items]
configure(widget, values = cb_pluck_labels(widget.values))
end
function set_items(widget::Tk_Combobox, items::Vector{T}) where {T <: AbstractString}
d = [(v,v) for v in items]
set_items(widget, d)
end
get_editable(widget::Tk_Combobox) = widget[:state] == "normal"
set_editable(widget::Tk_Combobox, value::Bool) = widget[:state] = value ? "normal" : "readonly"
## Slider
## deprecate this interface as integer values are not guaranteed in return.
function Slider(parent::Widget, range::UnitRange{T}; orient="horizontal") where {T <: Integer}
w = Slider(parent, orient=orient)
var = tclvar()
tclvar(var, minimum(range))
configure(w, from=minimum(range), to = maximum(range), variable=var)
w
end
function Slider(parent::Widget, lo::T, hi::T; orient = "horizontal") where {T <: Real}
w = Slider(parent, orient = orient)
var = tclvar()
tclvar(var, lo)
configure(w, from = lo, to = hi, variable = var)
w
end
get_value(widget::Tk_Scale) = parse(Float64, widget[:value])
function set_value(widget::Tk_Scale, value::Real)
variable = widget[:variable]
(variable == "") ? widget[:value] = value : tclvar(variable, value)
end
## bind needs extra args for command
function bind(widget::Tk_Scale, event::AbstractString, callback::Function)
if event == "command"
wrapper = (path, xs...) -> callback(path)
bind(widget.w, event, wrapper)
else
bind(widget, event, callback)
end
end
## Spinbox
mutable struct Tk_Spinbox <: TTk_Widget
w::TkWidget
range::UnitRange{Int}
Tk_Spinbox(w::TkWidget) = new(w, 1:1)
end
function Spinbox(parent, range::UnitRange{T}) where {T <: Integer}
w = Spinbox(parent)
set_items(w, range)
set_value(w, minimum(range))
w
end
get_value(widget::Tk_Spinbox) = parse(Int, tcl(widget, "get"))
set_value(widget::Tk_Spinbox, value::Integer) = tcl(widget, "set", value)
get_items(widget::Tk_Spinbox) = widget.range
function set_items(widget::Tk_Spinbox, range::UnitRange{T}) where T
configure(widget, from=minimum(range), to = maximum(range), increment = step(range))
widget.range = range
end
## Separator
function Separator(widget::Widget, horizontal::Bool)
w = Separator(widget)
configure(w, orient = (horizontal ? "horizontal" : "vertical"))
w
end
## Progressbar
function Progressbar(widget::Widget, mode::AbstractString)
w = Progressbar(widget)
configure(w, mode = mode) # one of "determinate", "indeterminate"
w
end
get_value(widget::Tk_Progressbar) = round(Int, parse(Float64, widget[:value]))
set_value(widget::Tk_Progressbar, value::Integer) = widget[:value] = min(100, max(0, value))
## Image
MaybeImage = Union{Nothing, Tk_Image}
to_tcl(x::Tk_Image) = x.w
function Image(fname::AbstractString)
if isfile(fname)
fname = escape_string(fname)
w = tcl(I"image create photo", file = fname)
Tk_Image(w)
else
error("Image needs filename of .gif file: $fname")
end
end
# Create an image as a bitmap
function Image(source::BitArray{2}, mask::BitArray{2}, background::AbstractString, foreground::AbstractString)
if size(source) != size(mask)
error("Source and mask must have the same size")
end
ssource = x11encode(source)
smask = x11encode(mask)
w = tcl(I"image create bitmap", data = ssource, maskdata = smask, background = background, foreground = foreground)
Tk_Image(w)
end
function x11header(s::IO, data::AbstractMatrix)
println(s, "#define im_width ", size(data, 2))
println(s, "#define im_height ", size(data, 1))
println(s, "static char im_bits[] = {")
end
function x11encode(data::BitArray{2})
# Not efficient, but easy
s = IOBuffer()
x11header(s, data)
u8 = zeros(UInt8, ceil(Int, size(data, 1)/8), size(data, 2))
for i = 1:size(data,1)
ii = ceil(Int, i/8)
n = i - 8*(ii-1) - 1
for j = 1:size(data,2)
u8[ii, j] |= convert(UInt8, data[i,j]) << n
end
end
for i = 1:length(u8)-1
print(s, u8[i], ",")
end
println(s, u8[end], "\n};")
takebuf_string(s)
end
## Entry
function Entry(parent::Widget, text::AbstractString)
w = Entry(parent)
set_value(w, text)
w
end
### methods
get_value(widget::Tk_Entry) = tcl(widget, "get")
function set_value(widget::Tk_Entry, val::AbstractString)
tcl(widget, I"delete @0 end")
tcl(widget, I"insert @0", tk_string_escape(val))
end
get_editable(widget::Tk_Entry) = widget[:state] == "normal"
set_editable(widget::Tk_Entry, value::Bool) = widget[:state] = value ? "normal" : "readonly"
## visibility is for passwords
get_visible(widget::Tk_Entry) = widget[:show] != "*"
set_visible(widget::Tk_Entry, value::Bool) = widget[:show] = value ? "{}" : "*"
## validate is one of none, key, focus, focusin, focusout or all
## validatecommand must return either tcl("expr", "FALSE") or tcl("expr", "TRUE") Use FALSE to call invalidate command
## percent substitution is matched in callbacks
function set_validation(widget::Tk_Entry, validate::AbstractString, validatecommand::Function, invalidcommand::MaybeFunction)
tk_configure(widget, validate=validate, validatecommand=validatecommand, invalidcommand=invalidcommand)
end
set_validation(widget::Tk_Entry, validate::AbstractString, validatecommand::Function) = set_validation(widget, validate, validatecommand, nothing)
## Scrollbar. Pass in parent and child. We configure both
## used in scrollbars_add
function Scrollbar(parent::Widget, child::Widget, orient::AbstractString)
which_view = (orient == "horizontal") ? "xview" : "yview"
scr = Scrollbar(parent, orient=orient, command=I("[list $(get_path(child)) $which_view]"))
d = Dict()
d[(orient == "horizontal") ? :xscrollcommand : :yscrollcommand] = I("[list $(get_path(scr)) set]")
configure(child, d)
scr
end
## Text
## non-exported helpers
get_text(widget::Tk_Text, start_index, end_index) = tcl(widget, "get", start_index, end_index)
function set_text(widget::Tk_Text, value::AbstractString, index)
tcl(widget, "insert", index, tk_string_escape(value))
end
get_value(widget::Tk_Text) = chomp(get_text(widget, "0.0", "end"))
function set_value(widget::Tk_Text, value::AbstractString)
path = get_path(widget)
tcl(widget, I"delete 0.0 end")
set_text(widget, value, "end")
tcl(widget, I"see 0.0")
end
get_editable(widget::Tk_Text) = widget[:state] != "disabled"
set_editable(widget::Tk_Text, value::Bool) = widget[:state] = value ? "normal" : "disabled"
## Tree
mutable struct Tk_Treeview <: TTk_Widget
w::Widget
names::MaybeVector
Tk_Treeview(w::Widget) = new(w, nothing)
end
mutable struct TreeNode node::AbstractString end
to_tcl(x::TreeNode) = x.node
MaybeTreeNode = Union{TreeNode, Nothing}
## Special Tree cases
## listbox like interface
function Treeview(widget::Widget, items::Vector{T}, title::AbstractString; selected_color::AbstractString="gray") where {T <: AbstractString}
w = Treeview(widget)
configure(w, show="tree headings", selectmode="browse")
tcl(w, I"heading #0", text = title)
tcl(w, I"column #0", anchor = I"w")
set_items(w, items)
tcl_eval("ttk::style map Treeview.Row -background [list selected $selected_color]")
w
end
Treeview(widget::Widget, items::Vector) = Treeview(widget, items, "")
function treeview_delete_children(widget::Tk_Treeview)
children = tcl(widget, I"children {}")
if children != ""
tcl(widget, "delete", children)
end
end
function set_items(widget::Tk_Treeview, items::Vector{T}) where {T <: AbstractString}
treeview_delete_children(widget)
for i in items
tcl(widget, I"insert {} end", text = i)
end
end
## t = Treeview(w, ["one" "two" "half"; "three" "four" "half"], [100, 50, 23])
function Treeview(widget::Widget, items::Array{T,2}, widths::MaybeVector) where {T <: AbstractString}
sz = size(items)
w = Treeview(widget)
configure(w, show = "tree headings", selectmode = "browse", columns=collect(1:(sz[2]-1)))
## widths ...
if isa(widths, Vector)
tcl(w, I"column #0", width = widths[1])
for k in 2:length(widths)
tcl(w, I"column", k - 1, width=widths[k])
end
end
set_items(w, items)
color = "gray"
tcl_eval("ttk::style map Treeview.Row -background [list selected $color]")
w
end
Treeview(widget::Widget, items::Array{T,2}) where {T <: AbstractString} = Treeview(widget, items, nothing)
function set_items(widget::Tk_Treeview, items::Array{T,2}) where {T <: AbstractString}
treeview_delete_children(widget)
sz = size(items)
for i in 1:sz[1]
vals = AbstractString[j for j in items[i,2:end]]
tcl(widget, I"insert {} end", text = items[i,1], values = vals)
end
end
## Return array of selected values by key or nothing
## A selected key is a string or array if path is needed
function get_value(widget::Tk_Treeview)
sels = selected_nodes(widget)
sels == nothing ? nothing : [tree_get_keys(widget, sel) for sel in sels]
end
## select row given by index. extend = true to add selection
function set_value(widget::Tk_Treeview, index::Integer, extend::Bool)
children = split(tcl(widget, "children", "{}"))
child = children[index]
tcl(widget, "selection", extend ? "add" : "set", child)
end
set_value(widget::Tk_Treeview, index::Integer) = set_value(widget, index, false)
## Some conveniences for working with trees
## w = Toplevel()
## f = Frame(w)
## tr = Treeview(f)
## scrollbars_add(f, tr)
## pack(f, expand=true, fill="both")
## set_size(w, 300, 300)
## ### Okay, lets make a tree
## d = ["data1", "data2"]
## id_1 = Tk.node_insert(tr, nothing, "node 1", d)
## id_1_1 = Tk.node_insert(tr, id_1, "node 1_1", d)
## id_1_2 = Tk.node_insert(tr, id_1, "node 1_2", d)
## id_2 = Tk.node_insert(tr, nothing, "node 2", d)
## Tk.tree_headers(tr, ["col 1", "col2"], [50, 75])
## used by get_value to return path of keys for a node
function tree_get_keys(widget::Tk_Treeview, node::TreeNode)
if tcl(widget, "exists", node) == "0" error("Node is not in tree") end
x = AbstractString[]
while node.node != ""
push!(x, tcl(widget, "item", node, "-text"))
node = TreeNode(tcl(widget, "parent", node))
end
length(x) > 1 ? reverse(x) : x[1] # return Vector or single value
end
## return vector of TreeNodes that are currently selected or nothing (Maybe{Vector{TreeNodes}}
function selected_nodes(widget::Tk_Treeview)
sel = tcl(widget, "selection")
length(sel) == 0 ? nothing : map(TreeNode, split(sel))
end
## insert into node, return new node
function node_insert(widget::Tk_Treeview, node::MaybeTreeNode, at::MaybeStringInteger,
text::MaybeString, image::MaybeImage, values::MaybeVector, opened::MaybeBool)
parent = isa(node, Nothing) ? "{}" : node.node
at = isa(at, Nothing) ? "end" : at
args = Dict()
args["text"] = isa(text, Nothing) ? "" : text
args["image"] = image.i
args["values"] = values
args["open"] = opened
id = tcl(widget, "insert", parent, at, args)
TreeNode(id)
end
## widget, node, text, image, values
node_insert(widget::Tk_Treeview, node::MaybeTreeNode, text::MaybeString, image::MaybeImage, values::MaybeVector) =
node_insert(widget, node, nothing, text, image, values, true)
## widget, node, text, values
node_insert(widget::Tk_Treeview, node::MaybeTreeNode, text::MaybeString, values::MaybeVector) =
node_insert(widget, node, nothing, text, nothing, values, true)
## widget, node, text
node_insert(widget::Tk_Treeview, node::MaybeTreeNode, text::MaybeString) =
insert_tree(widget, node, nothing, text, nothing, nothing, true)
## move node to parent and at, a string index, eg. "0" or "end".
function node_move(widget::Tk_Treeview, node::TreeNode, parent::MaybeTreeNode, at::MaybeStringInteger)
to = isa(parent, Nothing) ? "{}" : parent.node
ind = isa(at, Nothing) ? "end" : at
tcl(widget, "move", node.node, to, ind)
end
## move to end
node_move(widget::Tk_Treeview, node::TreeNode, parent::MaybeTreeNode) = node_move(widget, node, parent, nothing)
## remove a node
node_delete(widget::Tk_Treeview, node::TreeNode) = tcl(widget, "delete", node.node)
## Set or retrieve node open status
node_open(widget::Tk_Treeview, node::TreeNode, opened::Bool) = tcl(widget, "item", node, open=opened)
function node_open(widget::Tk_Treeview, node::TreeNode)
tcl(widget, "item", node, "-open") == "true" && tcl(widget, "children", node) != ""
end
## XXX This could be cleaned up a bit. It is annoying to treat the value and text differently when
## working on a grid XXX
## set column names, and widths. This works on values, not text part
function tree_headers(widget::Tk_Treeview, names::Vector{T}, widths::Vector{S}) where {T <: AbstractString, S<: Integer}
tree_headers(widget, names)
tree_column_widths(widget, widths)
end
function tree_headers(widget::Tk_Treeview, names::Vector{T}) where {T <: AbstractString}
tcl(widget, "configure", column=names)
widget.names = names
map(u -> tcl(widget, "heading", u, text=u), names)
end
## Set Column widths. Must have set headers first
function tree_column_widths(widget::Tk_Treeview, widths::Vector{T}) where {T <: Integer}
if widget.names == nothing
error("Must set header names, then widths")
end
heads = widget.names
if length(widths) == length(heads) + 1
tcl(widget, I"heading column #0", text=widths[1])
map(i -> tcl(widget, " column", heads[i], width=widths[i + 1]), 1:length(heads))
elseif length(widths) == length(heads)
map(i -> tcl(widget, "column", heads[i], width=widths[i]), 1:length(widths))
else
error("Widths must match number of column names or one more")
end
end
## set name and width of key column
## a ttk::treeview has a special column for the one which can expand
tree_key_header(widget::Tk_Treeview, name::AbstractString) = tcl(widget, I"heading #0", text = name)
tree_key_width(widget::Tk_Treeview, width::Integer) = tcl(widget, I"column #0", width = width)
## Canvas
## TkCanvas is plain canvas object, reserve name Canvas for Cairo enhanced one
function TkCanvas(widget::Tk_Widget, width::Integer, height::Integer)
TkCanvas(widget, width = width, height = height)
end
## Bring Canvas object into Tk_Widget level.
mutable struct Tk_CairoCanvas <: TTk_Widget
w::Canvas
end
function TkCairoCanvas(Widget::Tk_Widget; width::Int=-1, height::Int=-1)
c = Canvas(Widget.w, width, height)
Tk_CairoCanvas(c)
end
function Canvas(parent::TTk_Container, args...)
c = Canvas(parent.w, args...)
push!(parent.children, Tk_CairoCanvas(c))
c
end
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | code | 10158 | ## Tests
using Tk
using Test
@testset "Toplevel" begin
w = Toplevel("Toplevel", 400, 400)
set_position(w, 10, 10)
@test get_value(w) == "Toplevel"
set_value(w, "Toplevel 2")
@test get_value(w) == "Toplevel 2"
@test get_size(w) == [400, 400]
p = toplevel(w)
@test p == w
destroy(w)
@test !exists(w)
end
@testset "Frame" begin
w = Toplevel("Frame", 400, 400)
pack_stop_propagate(w)
f = Frame(w)
pack(f, expand=true, fill="both")
@test get_size(w) == [400, 400]
p = toplevel(f)
@test p == w
destroy(w)
end
@testset "Labelframe" begin
w = Toplevel("Labelframe", 400, 400)
pack_stop_propagate(w)
f = Labelframe(w, "Label")
pack(f, expand=true, fill="both")
set_value(f, "new label")
@test get_value(f) == "new label"
p = toplevel(f)
@test p == w
destroy(w)
end
@testset "Notebook" begin
w = Toplevel("Notebook")
nb = Notebook(w); pack(nb, expand=true, fill="both")
page_add(Button(nb, "one"), "tab one")
page_add(Button(nb, "two"), "tab two")
page_add(Button(nb, "three"), "tab three")
@test Tk.no_tabs(nb) == 3
set_value(nb, 2)
@test get_value(nb) == 2
destroy(w)
end
@testset "Panedwindow" begin
w = Toplevel("Panedwindow", 400, 400)
pack_stop_propagate(w)
pw = Panedwindow(w, "horizontal"); pack(pw, expand=true, fill="both")
page_add(Button(pw, "one"), 1)
page_add(Button(pw, "two"), 1)
page_add(Button(pw, "three"), 1)
set_value(pw, 100)
destroy(w)
end
@testset "pack Anchor" begin
w = Toplevel("Anchor argument", 500, 500)
pack_stop_propagate(w)
f = Frame(w, padding = [3,3,12,12]); pack(f, expand = true, fill = "both")
tr = Frame(f); mr = Frame(f); br = Frame(f)
map(u -> pack(u, expand =true, fill="both"), (tr, mr, br))
pack(Label(tr, "nw"), anchor = "nw", expand = true, side = "left")
pack(Label(tr, "n"), anchor = "n", expand = true, side = "left")
pack(Label(tr, "ne"), anchor = "ne", expand = true, side = "left")
##
pack(Label(mr, "w"), anchor = "w", expand =true, side ="left")
pack(Label(mr, "center"), anchor = "center", expand =true, side ="left")
pack(Label(mr, "e"), anchor = "e", expand =true, side ="left")
##
pack(Label(br, "sw"), anchor = "sw", expand = true, side = "left")
pack(Label(br, "s"), anchor = "s", expand = true, side = "left")
pack(Label(br, "se"), anchor = "se", expand = true, side = "left")
destroy(w)
end
## example of last in first covered
## Create this GUI, then shrink window with the mouse
@testset "Last in, first covered" begin
w = Toplevel("Last in, first covered", 400, 400)
f = Frame(w)
g1 = Frame(f)
g2 = Frame(f)
map(u -> pack(u, expand=true, fill="both"), (f, g1, g2))
b11 = Button(g1, "first")
b12 = Button(g1, "second")
b21 = Button(g2, "first")
b22 = Button(g2, "second")
map(u -> pack(u, side="left"), (b11, b12))
map(u -> pack(u, side="right"), (b21, b22))
## Now shrink window
destroy(w)
end
@testset "Grid" begin
w = Toplevel("Grid", 400, 400)
pack_stop_propagate(w)
f = Frame(w); pack(f, expand=true, fill="both")
grid(Slider(f, 1:10, orient="vertical"), 1:3, 1)
grid(Slider(f, 1:10), 1 , 2:3, sticky="news")
grid(Button(f, "2,2"), 2 , 2)
grid(Button(f, "2,3"), 2 , 3)
destroy(w)
end
@testset "Formlayout" begin
w = Toplevel("Formlayout")
f = Frame(w); pack(f, expand=true, fill="both")
map(u -> formlayout(Entry(f, u), u), ["one", "two", "three"])
destroy(w)
end
@testset "Widgets" begin
global ctr = 1
function cb(path)
global ctr
ctr += 1
end
global choices = ["choice one", "choice two", "choice three"]
@testset "button, label" begin
w = Toplevel("Widgets")
f = Frame(w); pack(f, expand=true, fill="both")
l = Label(f, "label")
b = Button(f, "button")
map(pack, (l, b))
set_value(l, "new label")
@test get_value(l) == "new label"
set_value(b, "new label")
@test get_value(b) == "new label"
bind(b, "command", cb)
tcl(b, "invoke")
@test ctr == 2
img = Image(joinpath(dirname(@__FILE__), "..", "examples", "weather-overcast.gif"))
map(u-> configure(u, image=img, compound="left"), (l,b))
destroy(w)
end
@testset "checkbox" begin
w = Toplevel("Checkbutton")
f = Frame(w)
pack(f, expand=true, fill="both")
check = Checkbutton(f, "check me"); pack(check)
set_value(check, true)
@test get_value(check) == true
set_items(check, "new label")
@test get_items(check) == "new label"
ctr = 1
bind(check, "command", cb)
tcl(check, "invoke")
@test ctr == 2
destroy(w)
end
@testset "radio" begin
w = Toplevel("Radio")
f = Frame(w)
pack(f, expand=true, fill="both")
r = Radio(f, choices); pack(r)
set_value(r, choices[1])
@test get_value(r) == choices[1]
set_value(r, 2) # by index
@test get_value(r) == choices[2]
@test get_items(r) == choices
destroy(w)
end
@testset "combobox" begin
w = Toplevel("Combobox")
f = Frame(w)
pack(f, expand=true, fill="both")
combo = Combobox(f, choices); pack(combo)
set_editable(combo, false) # default
set_value(combo, choices[1])
@test get_value(combo) == choices[1]
set_value(combo, 2) # by index
@test get_value(combo) == choices[2]
set_value(combo, nothing)
@test get_value(combo) == nothing
set_items(combo, map(uppercase, choices))
set_value(combo, 2)
@test get_value(combo) == uppercase(choices[2])
set_items(combo, Dict(:one=>"ONE", :two=>"TWO"))
set_value(combo, "one")
@test get_value(combo) == "one"
destroy(w)
end
@testset "slider" begin
w = Toplevel("Slider")
f = Frame(w)
pack(f, expand=true, fill="both")
sl = Slider(f, 1:10, orient="vertical"); pack(sl)
set_value(sl, 3)
@test get_value(sl) == 3
bind(sl, "command", cb) ## can't test
destroy(w)
end
@testset "spinbox" begin
w = Toplevel("Spinbox")
f = Frame(w)
pack(f, expand=true, fill="both")
sp = Spinbox(f, 1:10); pack(sp)
set_value(sp, 3)
@test get_value(sp) == 3
destroy(w)
end
@testset "progressbar" begin
w = Toplevel("Progress bar")
f = Frame(w)
pack(f, expand=true, fill="both")
pb = Progressbar(f, orient="horizontal"); pack(pb)
set_value(pb, 50)
@test get_value(pb) == 50
configure(pb, mode = "indeterminate")
destroy(w)
end
end
@testset "Entry" begin
w = Toplevel("Entry")
f = Frame(w)
pack(f, expand=true, fill="both")
e = Entry(f, "initial"); pack(e)
set_value(e, "new text")
@test get_value(e) == "new text"
set_value(e, "[1,2,3]")
@test get_value(e) == "[1,2,3]"
set_visible(e, false)
set_visible(e, true)
## Validation
function validatecommand(path, s, S)
println("old $s, new $S")
s == "invalid" ? tcl("expr", "FALSE") : tcl("expr", "TRUE") # *must* return logical in this way
end
function invalidcommand(path, W)
println("called when invalid")
tcl(W, "delete", "@0", "end")
tcl(W, "insert", "@0", "new text")
end
configure(e, validate="key", validatecommand=validatecommand, invalidcommand=invalidcommand)
destroy(w)
end
@testset "Text" begin
w = Toplevel("Text")
pack_stop_propagate(w)
f = Frame(w); pack(f, expand=true, fill="both")
txt = Text(f)
scrollbars_add(f, txt)
set_value(txt, "new text\n")
@test get_value(txt) == "new text\n"
set_value(txt, "[1,2,3]")
@test get_value(txt) == "[1,2,3]"
destroy(w)
end
@testset "tree. Listbox" begin
w = Toplevel("Listbox")
pack_stop_propagate(w)
f = Frame(w); pack(f, expand=true, fill="both")
tr = Treeview(f, choices)
## XXX scrollbars_add(f, tr)
set_value(tr, 2)
@test get_value(tr)[1] == choices[2]
set_items(tr, choices[1:2])
destroy(w)
end
@testset "tree grid" begin
w = Toplevel("Array")
pack_stop_propagate(w)
f = Frame(w); pack(f, expand=true, fill="both")
tr = Treeview(f, hcat(choices, choices))
tree_key_header(tr, "right"); tree_key_width(tr, 50)
tree_headers(tr, ["left"], [50])
scrollbars_add(f, tr)
set_value(tr, 2)
@test get_value(tr)[1] == choices[2]
destroy(w)
end
@testset "Canvas" begin
w = Toplevel("Canvas")
pack_stop_propagate(w)
f = Frame(w); pack(f, expand=true, fill="both")
c = Canvas(f)
@test parent(c) == f.w
@test toplevel(c) == w
destroy(w)
end
## Examples
# Wrap each test in its own module to avoid namespace leaks between files
const exampledir = joinpath(splitdir(splitdir(@__FILE__)[1])[1], "examples")
dcur = pwd()
cd(exampledir)
# TODO: Uncomment when Winston supports 0.6
#module example_manipulate
# if Pkg.installed("Winston")!=nothing
# include("../examples/manipulate.jl")
# end
#end
module example_process
using Test
@static if Sys.isunix()
@testset "Examples_Process" begin
@test_nowarn include(joinpath("..","examples","process.jl"))
end
end
end
module example_sketch
using Test
@testset "Examples_Sketch" begin
@test_nowarn include(joinpath("..","examples","sketch.jl"))
end
end
module example_test
using Test
@testset "Examples_Test" begin
@test_nowarn include(joinpath("..","examples","test.jl"))
@test_nowarn destroy(w)
end
end
module example_workspace
using Test
@testset "Examples_Workspace" begin
@test_nowarn include(joinpath("..","examples","workspace.jl"))
@test_nowarn aft.stop()
sleep(1.5)
@test_nowarn destroy(w)
end
end
cd(dcur)
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | docs | 1463 | # Julia interface to the Tk windowing toolkit.
| **Documentation** | **Build Status** |
|:-------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:|
| [![][docs-stable-img]][docs-stable-url] | [![][travis-img]][travis-url] [![][appveyor-img]][appveyor-url] [![][drone-img]][drone-url] |
[contrib-url]: https://juliadocs.github.io/Documenter.jl/dev/contributing/
[discourse-tag-url]: https://discourse.julialang.org/tags/documenter
[gitter-url]: https://gitter.im/juliadocs/users
[docs-dev-img]: https://img.shields.io/badge/docs-dev-blue.svg
[docs-dev-url]: https://https://pkg.julialang.org/docs/Tk
[docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg
[docs-stable-url]:https://pkg.julialang.org/docs/Tk
[travis-img]: https://travis-ci.org/JuliaGraphics/Tk.jl.svg?branch=master
[travis-url]: https://travis-ci.org/JuliaGraphics/Tk.jl
[appveyor-img]: https://ci.appveyor.com/api/projects/status/g14wsptfv2lq4oiv?svg=true
[appveyor-url]: https://ci.appveyor.com/project/aviks/tk-jl
[drone-img]: https://cloud.drone.io/api/badges/JuliaGraphics/Tk.jl/status.svg
[drone-url]: https://cloud.drone.io/JuliaGraphics/Tk.jl
[issues-url]: https://github.com/JuliaGraphics/Tk.jl/issues
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | docs | 98 | # Tk.jl API
```@index
```
```@autodocs
Modules = [Tk]
Order = [:type, :function]
```
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT"
] | 0.7.0 | 3ef117c610a41e41a429a4ebc5b744e84f205f74 | docs | 21079 | ## The Tk Package
This package provides an interface to the Tcl/Tk libraries, useful for
creating graphical user interfaces. The basic functionality is
provided by the `tcl_eval` function, which is used to pass on Tcl
commands. The `Canvas` widget is used to create a device for plotting
of `julia`'s graphics. In particular, among others, the `Winston` and
`Images` package can render to such a device.
The example `sketch.jl` illustrates this widget for a different purpose.
In addition, there are convenience methods for working with most of
the widgets provided by `Tk` similar to the ones found in `R`'s
`tcltk` package. For example, we add the `tcl` function as a wrapper
for `tcl_eval` which provides translations from `julia` objects into
Tcl constructs.
### Constructors
Constructors are provided for the following widgets
* `Toplevel`: for top level windows
* `Frame`, `Labelframe`, `Notebook`, `Panedwindow`: for the basic containers
* `Label`, `Button`, `Menu`: basic elements
* `Checkbutton`, `Radio`, `Combobox`, `Slider`, `Spinbox`: selection widgets
* `Entry`, `Text`: text widgets
* `Treeview`: for trees, but also listboxes and grids
* `Sizegrip`, `Separator`, `Progressbar`, `Image` various widgets
The basic usage simply calls the `ttk::` counterpart, though one can
use named arguments to pass in configuration options. As well, some have a
convenience interfaces.
### Methods
In addition to providing constructors, there are few additional
convenience methods defined.
* The `configure`, `cget`, `tclvar`, `identify`, `state`, `instate`,
`winfo`, `wm`, `bind` methods to simplify the corresponding Tcl
commands. For a single option of a widget accessed via `cget` and
modified via `configure`, one can use the index notation with a
symbol, as in `widget[:option]` or `widget[:option] = value`.
* For widget layout, we have `pack`, `pack_configure`, `forget`,
`grid`, `grid_configure`, `grid_forget`, ... providing interfaces to
the appropriate Tk commands, but also `formlayout` and `page_add`
for working with simple forms and notebooks and pane windows..
* We add the methods `get_value` and `set_value` to get and set the
primary value for a control
* We add the methods `get_items` and `set_items` to get and set the
item(s) to select from for selection widgets.
* We add the methods `width`, `height`, `get_size` to get the
on-screen size of a widget. For top level windows there are
`set_width`, `set_height`, and `set_size` for adjusting the
geometry. The `:width` and `:height` properties are common to most
widgets, and return the _requested_ width and height, which need not
be the actual width and height on screen.
* The conveniences `get_enabled` and `set_enabled` to specify if a
widget accepts user input
## Examples
### Hello world
A simple "Hello world" example, which shows off many of the styles is given by:
```jl
w = Toplevel("Example") ## A titled top level window
f = Frame(w, padding = [3,3,2,2], relief="groove") ## A Frame with some options set
pack(f, expand = true, fill = "both") ## using pack to manage the layout of f
#
b = Button(f, "Click for a message") ## Button constructor has convenience interface
grid(b, 1, 1) ## use grid to pack in b. 1,1 specifies location
#
callback(path) = Messagebox(w, title="A message", message="Hello World") ## A callback to open a message
bind(b, "command", callback) ## bind callback to 'command' option
bind(b, "<Return>", callback) ## press return key when button has focus
```
We see the use of an internal frame to hold the button. The frame's
layout is managed using `pack`, the buttons with `grid`. Both these
have some conveniences. For grid, the location of the cell can be
specified by 1-based index as shown. The button callback is just a
`julia` function. Its first argument, `path`, is used internally. In
this case, we open a modal dialog with the `Messagebox` constructor
when the callback is called. The button object has this callback bound
to the button's `command` option. This responds to a mouse click, but
not a press of the `enter` key when the button has the focus. For
that, we also bind to the `<Return>` event.
For the R package `tctlk` there are numerous examples at
http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/ . We borrow a
few of these to illustrate the `Tk` package for `julia`.
`Tk` commands are combined strings followed by options. Something
like: `.button configure -text {button text}` is called as
`configure(button, text = "button text)`. Key-value options are
specified with through named arguments, which are converted to the
underlying Tcl object. Similarly, path names are also translated and
functions are converted to callbacks.
### Pack widgets into a themed widget for better appearance
`Toplevel` is the command to create a new top-level
window. (`Tk.Window` is similar, but we give `Toplevel` a unique type
allowing us to add methods, such as `set_value` to modify the title.)
Toplevel windows play a special role, as they start the widget
hierarchy needed when constructing child components.
A top level window is not a themed widget. Immediately packing in a
`Frame` instance is good practice, as otherwise the background of the
window may show through:
```jl
w = Toplevel()
f = Frame(w)
pack(f, expand=true, fill="both")
```
#### Notes:
* Sometimes the frame is configured with padding so that the sizegrip
shows, e.g. `frame(w, padding = [3,3,2,2])`.
* The above will get the size from the frame -- which has no
request. This means the window will disappear. You may want to force
the size to come from the top level window. You can use `tcl("pack",
"propagate", w, false)` (wrapped in `pack_stop_propagate`) to get
this:
```jl
w = Toplevel("title", 400, 300) ## title, width, height
pack_stop_propagate(w)
f = Frame(w)
pack(f, expand=true, fill="both")
```
* resizing top level windows with the mouse can leave visual artifacts, at least on a
Mac. This is not optimal! (The picture below can be avoided by packing an expanding frame into the top level widget.)

### Message Box
The `Messagebox` constructor makes a modal message box.
```jl
Messagebox(title="title", message="message")
```
An optional `parent` argument can be specified to locate the box near
the parent, as seen in the examples.
### File Dialogs
File Open, File Save and Choose Directory dialogs can be invoked as follows.
```jl
GetOpenFile()
GetSaveFile()
ChooseDirectory()
```
### Checkbuttons

Check boxes are constructed with `Checkbutton`:
```jl
w = Toplevel()
f = Frame(w)
pack(f, expand=true, fill="both")
cb = Checkbutton(f, "I like Julia")
pack(cb)
function callback(path) ## callbacks have at least one argument
value = get_value(cb)
msg = value ? "Glad to hear that" : "Sorry to hear that"
Messagebox(w, title="Thanks for the feedback", message=msg)
end
bind(cb, "command", callback) ## bind to command option
```
The `set_items` method can be used to change the label.
### Radio buttons

```jl
w = Toplevel()
f = Frame(w)
pack(f, expand=true, fill="both")
l = Label(f, "Which do you prefer?")
rb = Radio(f, ["apples", "oranges"])
b = Button(f, "ok")
map(u -> pack(u, anchor="w"), (l, rb, b)) ## pack in left to right
function callback(path)
msg = (get_value(rb) == "apples") ? "Good choice! An apple a day keeps the doctor away!" :
"Good choice! Oranges are full of Vitamin C!"
Messagebox(w, msg)
end
bind(b, "command", callback)
```
The individual buttons can be accessed via the `buttons` property. This
allows one to edit the labels, as in
```jl
set_items(rb.buttons[1], "Honeycrisp Apples")
```
(The `set_items` method is used to set the items for a selection
widget, in this case the lone item is the name, or label of the
button.)
### Menus
Menu bars for top level windows are easily created with the `menu_add`
method. One can add actions items (pass a callback function), check
buttons, radio buttons, or separators.
```jl
w = Toplevel()
tcl("pack", "propagate", w, false) ## or pack_stop_propagate(w)
mb = Menu(w) ## makes menu, adds to top-level window
fmenu = menu_add(mb, "File")
omenu = menu_add(mb, "Options")
menu_add(fmenu, "Open file...", (path) -> println("Open file dialog, ..."))
menu_add(fmenu, Separator(w)) ## second argument is Tk_Separator instance
menu_add(fmenu, "Close window", (path) -> destroy(w))
cb = Checkbutton(w, "Something visible")
set_value(cb, true) ## initialize
menu_add(omenu, cb) ## second argument is Tk_Checkbutton instance
menu_add(omenu, Separator(w)) ## put in a separator
rb = Radio(w, ["option 1", "option 2"])
set_value(rb, "option 1") ## initialize
menu_add(omenu, rb) ## second argument is Tk_Radio instance
b = Button(w, "print selected options")
pack(b, expand=true, fill="both")
function callback(path)
vals = map(get_value, (cb, rb))
println(vals)
end
callback_add(b, callback) ## generic way to add callback for most common event
)
```
### Entry widget

The entry widget can be used to collect data from the user.
```jl
w = Toplevel()
f = Frame(w); pack(f, expand=true, fill="both")
e = Entry(f)
b = Button(f, "Ok")
formlayout(e, "First name:")
formlayout(b, nothing)
focus(e) ## put keyboard focus on widget
function callback(path)
val = get_value(e)
msg = "You have a nice name $val"
Messagebox(w, msg)
end
bind(b, "command", callback)
bind(b, "<Return>", callback)
bind(e, "<Return>", callback) ## bind to a certain key press event
```
### Listboxes

There is no `Listbox` constructor; rather, we replicate this with
`Treeview` simply by passing a vector of strings. Here we use a
scrollbar too:
```jl
fruits = ["Apple", "Navel orange", "Banana", "Pear"]
w = Toplevel("Favorite fruit?")
tcl("pack", "propagate", w, false)
f = Frame(w)
pack(f, expand=true, fill="both")
f1 = Frame(f) ## need internal frame for use with scrollbars
lb = Treeview(f1, fruits)
scrollbars_add(f1, lb)
pack(f1, expand=true, fill="both")
b = Button(f, "Ok")
pack(b)
bind(b, "command") do path ## do style
fruit_choice = get_value(lb)
msg = (fruit_choice == nothing) ? "What, no choice?" : "Good choice! $(fruit_choice[1])" * "s are delicious!"
Messagebox(w, msg)
end
```
The value returned by `get_value` is an array or `nothing`. Returning
`nothing` may not be the best choice, perhaps a 0-length array is
better?
One can configure the `selectmode`, e.g. `configure(lb,
selectmode = "extended")` with either `extended` (multiple
selection possible, `browse` (single selection), or `none` (no
selection).) The shortcut `lb[:selectmode] = "extended"` will also work.
The `Treeview` widget can also display a matrix of strings in a grid
in addition to tree-like data.
An editable grid could be done, but requires some additional Tk
libraries.
### Combo boxes
Selection from a list of choices can be done with a combo box:

```jl
fruits = ["Apple", "Navel orange", "Banana", "Pear"]
w = Toplevel("Combo boxes", 300, 200)
tcl("pack", "propagate", w, false)
f = Frame(w); pack(f, expand=true, fill="both")
grid(Label(f, "Again, What is your favorite fruit?"), 1, 1)
cb = Combobox(f, fruits)
grid(cb, 2,1, sticky="ew")
b = Button(f, "Ok")
grid(b, 3, 1)
function callback(path)
fruit_choice = get_value(cb)
msg = (fruit_choice == nothing) ? "What, no choice?" :
"Good choice! $(fruit_choice)" * "s are delicious!"
Messagebox(w, msg)
end
bind(b, "command", callback)
```
Here no choice also returns `nothing`. Use this value with `set_value`
to clear the selection, if desired.
Editable combo boxes need to be configured by hand. (So combo isn't
really what we have here :)
### Text windows
The basic multi-line text widget can be done through:
```jl
w = Toplevel()
tcl("pack", "propagate", w, false)
f = Frame(w)
txt = Text(f)
scrollbars_add(f, txt)
pack(f, expand=true, fill = "both")
```
Only a `get_value` and `set_value` is provided. One can configure
other things (adding/inserting text, using tags, ...) directly with
`tcl` or `tcl_eval`.
### Events
One can bind a callback to an event in Tcl/Tk. There are few things to know:
* Callbacks have at least one argument (we use `path`). With
`bind`, other arguments are matched by name to correspond to
Tcl/Tk's percent substitution. E.g. `f(path, x, y)` would get values
for x and y through `%x %y`.
* We show how to bind to a widget event, but this can be more
general. E.g., top level events are for all children of the window a
style can match all object of that style.
* many widgets have a standard `command` argument in addition to
window manager events they respond to. The value `command` can be passed to
`bind` as the event.
* The `bind` method does most of the work. The `callback_add`
method binds to the most common event, mostly the `command`
one. This can be used to bind the same callback to multiple widgets
at once.
### Sliders
The `Slider` widget presents a slider for selection from a range of
values. The convenience constructor allows one to specify the range of
values through a `Range` object, or the low and high `float` values of the range. Note
that `get_value` returns a `float`, even if used with an integer range.
```jl
w = Toplevel()
f = Frame(w)
pack(f, expand=true, fill="both")
pack(Label(f, "Int Range slider"), side="top")
s_range = Slider(f, 1:100)
pack(s_range, side="top", expand=true, fill="both", anchor="w")
bind(s_range, "command", path -> println("The range value is $(int(get_value(s_range)))"))
pack(Label(f, "Float slider"), side="top")
s_float = Slider(f, 0.0, 1.0)
pack(s_float, side="top", expand=true, fill="both", anchor="w")
bind(s_float, "command", path -> println("The float value is $(get_value(s_float))"))
```
One can also call `bind` using the `do` idiom:
```jl
bind(sc, "command") do path
println("The value is $(get_value(sc))")
end
```
### Sharing a variable between widgets

Some widgets have a `textvariable` option. These can be shared to have
automatic synchronization. For example, the scale widget does not have
any indication as to the value, we remedy this with a label.
```jl
w = Toplevel("Slider and label", 300, 200)
f = Frame(w); pack(f, expand = true, fill = "both")
sc = Slider(f, 1:20)
l = Label(f)
l[:textvariable] = sc[:variable]
grid(sc, 1, 1, sticky="ew")
grid(l, 2, 1, sticky="nw")
grid_columnconfigure(f, 1, weight=1)
```
This combination above is not ideal, as the length of the label is not
fixed. It would be better to format the value and use `set_value` in a
callback.
### Spinbox

The scale widget easily lets one pick a value, but it can be hard to
select a precise one. The spinbox makes this easier. Here we link the
two using a callback:
```jl
w = Toplevel("Slider/Spinbox")
f = Frame(w); pack(f, expand = true, fill = "both")
sc = Slider(f, 1:100)
sp = Spinbox(f, 1:100)
map(pack, (sc, sp))
bind(sc, "command", path -> set_value(sp, get_value(sc)))
bind(sp, "command", path -> set_value(sc, get_value(sp)))
```
### Images

The `Image` widget can be used to show `gif` files.
```jl
fname = Pkg.dir("Tk", "examples", "logo.gif")
img = Image(fname)
w = Toplevel("Image")
f = Frame(w); pack(f, expand = true, fill = "both")
l = Label(f, img)
pack(l)
```
This example adds an image to a button.
```jl
fname = Pkg.dir("Tk", "examples", "weather-overcast.gif") ## https://code.google.com/p/ultimate-gnome/
img = Image(fname)
w = Toplevel("Icon in button")
f = Frame(w); pack(f, expand = true, fill = "both")
b = Button(f, "weather", img) ## or: b = Button(f, text="weather", image=img, compound="left")
pack(b)
```
### Graphics
The `Canvas` widget can be placed in a GUI to embed a graphics device. In the
examples directory you can find an implementation of RStudio's `manipulate`
function. This functions makes it very straightforward to define basic
interactive GUIs for plotting with `Winston`.
To try it, run
```jl
require(Pkg.dir("Tk", "examples", "manipulate.jl"))
```
The above graphic was produced with:
```jl
ex = quote
x = linspace( 0, n * pi, 100 )
c = cos(x)
s = sin(x)
p = FramedPlot()
setattr(p, "title", title)
if
fillbetween add(p, FillBetween(x, c, x, s) )
end
add(p, Curve(x, c, "color", color) )
add(p, Curve(x, s, "color", "blue") )
file(p, "example1.png")
p ## return a winston object
end
obj = manipulate(ex,
slider("n", "[0, n*pi]", 1:10)
,entry("title", "Title", "title")
,checkbox("fillbetween", "Fill between?", true)
,picker("color", "Cos color", ["red", "green", "yellow"])
,button("update")
)
```
### Frames
The basic widget to hold child widgets is the Frame. As seen in the
previous examples, it is simply constructed with `Frame`. The
`padding` option can be used to give some breathing room.
Laying out child components is done with a layout manager, one of
`pack`, `grid`, or `place` in Tk.
#### pack
For `pack` there are several configuration options that are used to
indicate how packing of child components is to be done. The examples
make use of
* `side`: to indicate the side of the cavity that the child should be
packed against. Typically "top" to top to bottom packing or "left"
for left to right packing.
* `anchor`: One of the compass points indicating what part of the
cavity the child should be attached to.
* `expand`: should the child expand when packed
* `fill`: how should an expanding child fill its space. We use
`{:expand=>true, :fill=>"both"}` to indicate the child should take
all the available space it can. Use `"x"` to stretch horizontally,
and `"y"` to stretch vertically.
Unlike other toolkits (Gtk, Qt), one can pack both horizontally and
vertically within a frame. So to pack horizontally, one must add the
`side` option each time. It can be convenient to do this using a map
by first creating the widgets, then managing them:
```jl
w = Toplevel("packing example")
f = Frame(w); pack(f, expand=true, fill="both")
ok_b = Button(f, "Ok")
cancel_b = Button(f, "Cancel")
help_b = Button(f, "Help")
map(u -> pack(u, side = "left"), (ok_b, cancel_b, help_b))
```
#### grid
For `grid`, the arguments are the row and column. We use integers or ranges.
When given a range, the widget can span multiple rows or columns. Within a
cell, the `sticky` argument replaces the `expand`, `fill`, and `anchor`
arguments. This is a string with one or more directions to attach. A value of
`news` is like `Dict(:expand=>true, :fill=>"both")`, as all four sides are
attached to.

```jl
w = Toplevel("Grid")
f = Frame(w, padding = 10); pack(f, expand=true, fill="both")
s1 = Slider(f, 1:10)
s2 = Slider(f, 1:10, orient="vertical")
b3 = Button(f, "ew sticky")
b4 = Button(f, "ns sticky")
grid(s1, 1, 1:2, sticky="news")
grid(s2, 2:3, 2, sticky="news")
grid(b3, 2, 1)
grid(b4, 3, 1, sticky="ns") ## breaks theme
```
We provide the `formlayout` method for conveniently laying out widgets
in a form-like manner, with a label on the left. (Pass `nothing` to
suppress this.)
One thing to keep in mind: *a container in Tk can only employ one
layout style for its immediate children* That is, you can't manage
children both with `pack` and `grid`, though you can nest frames and
mix and match layout managers.
### Notebooks
A notebook container holds various pages and draws tabs to allow the
user to switch between them. The `page_add` method makes this easy:
```jl
w = Toplevel()
tcl("pack", "propagate", w, false)
nb = Notebook(w)
pack(nb, expand=true, fill="both")
page1 = Frame(nb)
page_add(page1, "Tab 1")
pack(Button(page1, "page 1"))
page2 = Frame(nb)
page_add(page2, "Tab 2")
pack(Label(page2, "Some label"))
set_value(nb, 2) ## position on page 2
```
### Panedwindows
A paned window allows a user to allocate space between child
components using their mouse. This is done by dragging a "sash". As
with `Notebook` containers, children are added through `page_add`.
```jl
w = Toplevel("Panedwindow", 800, 300)
tcl("pack", "propagate", w, false)
f = Frame(w); pack(f, expand=true, fill="both")
pg = Panedwindow(f, "horizontal") ## orientation. Use "vertical" for up down.
grid(pg, 1, 1, sticky = "news")
page_add(Button(pg, "button"))
page_add(Label(pg, "label"))
f = Frame(pg)
formlayout(Entry(f), "Name:")
formlayout(Entry(f), "Rank:")
formlayout(Entry(f), "Serial Number:")
page_add(f)
set_value(pg, 100) ## set divider between first two pixels
tcl(pg, "sashpos", 1, 200) ## others set the tcl way
```
| Tk | https://github.com/JuliaGraphics/Tk.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 294 | module SLICOTMath
using SLICOT_jll
using LinearAlgebra
using LinearAlgebra: BlasInt
using DocStringExtensions
function chkargsok(ret::BlasInt)
if ret < 0
throw(ArgumentError("invalid argument #$(-ret) to SLICOT call"))
end
end
include("slicot_m.jl")
include("m_docs.jl")
end
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 162864 | # Portions extracted from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
"""
Compute the complex square root YR + i*YI of a complex number
XR + i*XI in real arithmetic. The returned result is so that
YR >= 0.0 and SIGN(YI) = SIGN(XI).
See the SLICOT documentation for details.
"""
function ma01ad! end
"""
Compute the general product of K real scalars without over-
or underflow.
See the SLICOT documentation for details.
"""
function ma01bd! end
"""
Compute the general product of K complex scalars trying to
avoid over- and underflow.
See the SLICOT documentation for details.
"""
function ma01bz! end
"""
Compute, without over- or underflow, the sign of the sum of two
real numbers represented using integer powers of a base (usually,
the machine base). Any base can be used, but it should the same
for both numbers. The result is an integer with value 1, 0, or -1,
depending on the sum being found as positive, zero, or negative,
respectively.
See the SLICOT documentation for details.
"""
function ma01cd! end
"""
Transpose all or part of a two-dimensional matrix A into
another matrix B.
See the SLICOT documentation for details.
"""
function ma02ad! end
"""
Reverse the order of rows and/or columns of a given matrix A
by pre-multiplying and/or post-multiplying it, respectively, with
a permutation matrix P, where P is a square matrix of appropriate
order, with ones down the secondary diagonal.
See the SLICOT documentation for details.
"""
function ma02bd! end
"""
Reverse the order of rows and/or columns of a given matrix A
by pre-multiplying and/or post-multiplying it, respectively, with
a permutation matrix P, where P is a square matrix of appropriate
order, with ones down the secondary diagonal.
See the SLICOT documentation for details.
"""
function ma02bz! end
"""
Compute the pertranspose of a central band of a square matrix.
See the SLICOT documentation for details.
"""
function ma02cd! end
"""
Compute the pertranspose of a central band of a square matrix.
See the SLICOT documentation for details.
"""
function ma02cz! end
"""
Pack/unpack the upper or lower triangle of a symmetric matrix.
The packed matrix is stored column-wise in the one-dimensional
array AP.
See the SLICOT documentation for details.
"""
function ma02dd! end
"""
Store by symmetry the upper or lower triangle of a symmetric
matrix, given the other triangle.
See the SLICOT documentation for details.
"""
function ma02ed! end
"""
Store by skew-symmetry the upper or lower triangle of a
skew-symmetric matrix, given the other triangle. The diagonal
entries are set to zero.
See the SLICOT documentation for details.
"""
function ma02es! end
"""
Store by (skew-)symmetry the upper or lower triangle of a
(skew-)symmetric/Hermitian complex matrix, given the other
triangle.
See the SLICOT documentation for details.
"""
function ma02ez! end
"""
Compute the coefficients c and s (c^2 + s^2 = 1) for a modified
hyperbolic plane rotation, such that,
`y1 := 1/c * x1 - s/c * x2 = sqrt(x1^2 - x2^2),`
`y2 := -s * y1 + c * x2 = 0,`
given two real numbers x1 and x2, satisfying either x1 = x2 = 0,
or abs(x2) < abs(x1).
See the SLICOT documentation for details.
"""
function ma02fd! end
"""
Perform a series of column interchanges on the matrix A.
One column interchange is initiated for each of columns K1 through
K2 of A. This is useful for solving linear systems X*A = B, when
the matrix A has already been factored by LAPACK Library routine
DGETRF.
See the SLICOT documentation for details.
"""
function ma02gd! end
"""
Perform a series of column interchanges on the matrix A.
One column interchange is initiated for each of columns K1 through
K2 of A. This is useful for solving linear systems X*A = B, when
the matrix A has already been factored by LAPACK Library routine
DGETRF.
See the SLICOT documentation for details.
"""
function ma02gz! end
"""
Check if A = DIAG*I, where I is an M-by-N matrix with ones on
the diagonal and zeros elsewhere.
See the SLICOT documentation for details.
"""
function ma02hd! end
"""
Check if A = DIAG*I, where I is an M-by-N matrix with ones on
the diagonal and zeros elsewhere, A is a complex matrix and DIAG
is a complex scalar.
See the SLICOT documentation for details.
"""
function ma02hz! end
"""
Compute the value of the one norm, or the Frobenius norm, or
the infinity norm, or the element of largest absolute value
of a real skew-Hamiltonian matrix
`[ A G ] T T`
`X = [ T ], G = -G, Q = -Q,`
`[ Q A ]`
or of a real Hamiltonian matrix
`[ A G ] T T`
`X = [ T ], G = G, Q = Q,`
`[ Q -A ]`
where A, G and Q are real n-by-n matrices.
Note that for this kind of matrices the infinity norm is equal
to the one norm.
See the SLICOT documentation for details.
"""
function ma02id! end
"""
Compute the value of the one norm, or the Frobenius norm, or
the infinity norm, or the element of largest absolute value
of a complex skew-Hamiltonian matrix
`[ A G ] H H`
`X = [ H ], G = -G, Q = -Q,`
`[ Q A ]`
or of a complex Hamiltonian matrix
`[ A G ] H H`
`X = [ H ], G = G, Q = Q,`
`[ Q -A ]`
where A, G and Q are complex n-by-n matrices.
Note that for this kind of matrices the infinity norm is equal
to the one norm.
See the SLICOT documentation for details.
"""
function ma02iz! end
"""
Compute || Q^T Q - I ||_F for a matrix of the form
`[ op( Q1 ) op( Q2 ) ]`
`Q = [ ],`
`[ -op( Q2 ) op( Q1 ) ]`
where Q1 and Q2 are N-by-N matrices. This residual can be used to
test wether Q is numerically an orthogonal symplectic matrix.
See the SLICOT documentation for details.
"""
function ma02jd! end
"""
Compute || Q^H Q - I ||_F for a complex matrix of the form
`[ op( Q1 ) op( Q2 ) ]`
`Q = [ ],`
`[ -op( Q2 ) op( Q1 ) ]`
where Q1 and Q2 are N-by-N matrices. This residual can be used to
test wether Q is numerically a unitary symplectic matrix.
See the SLICOT documentation for details.
"""
function ma02jz! end
"""
Compute the value of the one norm, or the Frobenius norm, or
the infinity norm, or the element of largest absolute value
of a real skew-symmetric matrix.
Note that for this kind of matrices the infinity norm is equal
to the one norm.
See the SLICOT documentation for details.
"""
function ma02md! end
"""
Compute the value of the one norm, or the Frobenius norm, or
the infinity norm, or the element of largest absolute value
of a complex skew-Hermitian matrix.
Note that for this kind of matrices the infinity norm is equal
to the one norm.
See the SLICOT documentation for details.
"""
function ma02mz! end
"""
Permute two specified rows and corresponding columns of a
(skew-)symmetric/Hermitian complex matrix.
See the SLICOT documentation for details.
"""
function ma02nz! end
"""
Compute the number of zero rows (and zero columns) of a real
(skew-)Hamiltonian matrix,
`( A D )`
`H = ( ).`
`( E +/-A' )`
See the SLICOT documentation for details.
"""
function ma02od! end
"""
Compute the number of zero rows (and zero columns) of a complex
(skew-)Hamiltonian matrix,
`( A D )`
`H = ( ).`
`( E +/-A' )`
See the SLICOT documentation for details.
"""
function ma02oz! end
"""
Compute the number of zero rows and zero columns of a real
matrix.
See the SLICOT documentation for details.
"""
function ma02pd! end
"""
Compute the number of zero rows and zero columns of a complex
matrix.
See the SLICOT documentation for details.
"""
function ma02pz! end
"""
Perform one of the skew-symmetric rank 2k operations
`C := alpha*A*B' - alpha*B*A' + beta*C,`
or
`C := alpha*A'*B - alpha*B'*A + beta*C,`
where alpha and beta are scalars, C is a real N-by-N skew-
symmetric matrix and A, B are N-by-K matrices in the first case
and K-by-N matrices in the second case.
This is a modified version of the vanilla implemented BLAS
routine DSYR2K written by Jack Dongarra, Iain Duff,
Jeremy Du Croz and Sven Hammarling.
See the SLICOT documentation for details.
"""
function mb01kd! end
"""
Compute the matrix formula
`_`
`R = alpha*R + beta*op( A )*X*op( A )',`
`_`
where alpha and beta are scalars, R, X, and R are skew-symmetric
matrices, A is a general matrix, and op( A ) is one of
`op( A ) = A or op( A ) = A'.`
The result is overwritten on R.
See the SLICOT documentation for details.
"""
function mb01ld! end
"""
Perform the matrix-vector operation
`y := alpha*A*x + beta*y,`
where alpha and beta are scalars, x and y are vectors of length
n and A is an n-by-n skew-symmetric matrix.
This is a modified version of the vanilla implemented BLAS
routine DSYMV written by Jack Dongarra, Jeremy Du Croz,
Sven Hammarling, and Richard Hanson.
See the SLICOT documentation for details.
"""
function mb01md! end
"""
Perform the skew-symmetric rank 2 operation
`A := alpha*x*y' - alpha*y*x' + A,`
where alpha is a scalar, x and y are vectors of length n and A is
an n-by-n skew-symmetric matrix.
This is a modified version of the vanilla implemented BLAS
routine DSYR2 written by Jack Dongarra, Jeremy Du Croz,
Sven Hammarling, and Richard Hanson.
See the SLICOT documentation for details.
"""
function mb01nd! end
"""
Perform one of the special symmetric rank 2k operations
`R := alpha*R + beta*H*X + beta*X*H',`
or
`R := alpha*R + beta*H'*X + beta*X*H,`
where alpha and beta are scalars, R and X are N-by-N symmetric
matrices, and H is an N-by-N upper Hessenberg matrix.
See the SLICOT documentation for details.
"""
function mb01oc! end
"""
Compute the matrix formula
`R := alpha*R + beta*( op( H )*X*op( E )' + op( E )*X*op( H )' ),`
where alpha and beta are scalars, R and X are symmetric matrices,
H is an upper Hessenberg matrix, E is an upper triangular matrix,
and op( M ) is one of
`op( M ) = M or op( M ) = M'.`
The result is overwritten on R.
See the SLICOT documentation for details.
"""
function mb01od! end
"""
Compute one of the symmetric rank 2k operations
`R := alpha*R + beta*H*E' + beta*E*H',`
or
`R := alpha*R + beta*H'*E + beta*E'*H,`
where alpha and beta are scalars, R, E, and H are N-by-N matrices,
with H upper Hessenberg and E upper triangular.
See the SLICOT documentation for details.
"""
function mb01oe! end
"""
Compute one of the symmetric rank 2k operations
`R := alpha*R + beta*H*A' + beta*A*H',`
or
`R := alpha*R + beta*H'*A + beta*A'*H,`
where alpha and beta are scalars, R, A, and H are N-by-N matrices,
with A and H upper Hessenberg.
See the SLICOT documentation for details.
"""
function mb01oh! end
"""
Compute either P or P', with P defined by the matrix formula
`P = op( H )*X*op( E )',`
where H is an upper Hessenberg matrix, X is a symmetric matrix,
E is an upper triangular matrix, and op( M ) is one of
`op( M ) = M or op( M ) = M'.`
See the SLICOT documentation for details.
"""
function mb01oo! end
"""
Compute P = H*X or P = X*H, where H is an upper Hessenberg
matrix and X is a symmetric matrix.
See the SLICOT documentation for details.
"""
function mb01os! end
"""
Compute one of the symmetric rank 2k operations
`R := alpha*R + beta*E*T' + beta*T*E',`
or
`R := alpha*R + beta*E'*T + beta*T'*E,`
where alpha and beta are scalars, R, T, and E are N-by-N matrices,
with T and E upper triangular.
See the SLICOT documentation for details.
"""
function mb01ot! end
"""
Scale a matrix or undo scaling. Scaling is performed, if
necessary, so that the matrix norm will be in a safe range of
representable numbers.
See the SLICOT documentation for details.
"""
function mb01pd! end
"""
Multiply the M by N real matrix A by the real scalar CTO/CFROM.
This is done without over/underflow as long as the final result
CTO*A(I,J)/CFROM does not over/underflow. TYPE specifies that
A may be full, (block) upper triangular, (block) lower triangular,
(block) upper Hessenberg, or banded.
See the SLICOT documentation for details.
"""
function mb01qd! end
"""
Compute either the upper or lower triangular part of one of the
matrix formulas
`_`
`R = alpha*R + beta*op( A )*B, (1)`
`_`
`R = alpha*R + beta*B*op( A ), (2)`
`_`
where alpha and beta are scalars, R and R are m-by-m matrices,
op( A ) and B are m-by-n and n-by-m matrices for (1), or n-by-m
and m-by-n matrices for (2), respectively, and op( A ) is one of
`op( A ) = A or op( A ) = A', the transpose of A.`
The result is overwritten on R.
See the SLICOT documentation for details.
"""
function mb01rb! end
"""
Compute the matrix formula
`_`
`R = alpha*R + beta*op( A )*X*op( A )',`
`_`
where alpha and beta are scalars, R, X, and R are symmetric
matrices, A is a general matrix, and op( A ) is one of
`op( A ) = A or op( A ) = A'.`
The result is overwritten on R.
See the SLICOT documentation for details.
"""
function mb01rd! end
"""
Compute the matrix formula
`R := alpha*R + beta*op( H )*X*op( H )',`
where alpha and beta are scalars, R and X are symmetric matrices,
H is an upper Hessenberg matrix, and op( H ) is one of
`op( H ) = H or op( H ) = H'.`
The result is overwritten on R.
See the SLICOT documentation for details.
"""
function mb01rh! end
"""
Compute the matrix formula
`R := alpha*R + beta*op( E )*X*op( E )',`
where alpha and beta are scalars, R and X are symmetric matrices,
E is an upper triangular matrix, and op( E ) is one of
`op( E ) = E or op( E ) = E'.`
The result is overwritten on R.
See the SLICOT documentation for details.
"""
function mb01rt! end
"""
Compute the matrix formula
`_`
`R = alpha*R + beta*op( A )*X*op( A )',`
`_`
where alpha and beta are scalars, R, X, and R are symmetric
matrices, A is a general matrix, and op( A ) is one of
`op( A ) = A or op( A ) = A'.`
The result is overwritten on R.
See the SLICOT documentation for details.
"""
function mb01ru! end
"""
Compute the transformation of the symmetric matrix A by the
matrix Z in the form
`A := op(Z)*A*op(Z)',`
where op(Z) is either Z or its transpose, Z'.
See the SLICOT documentation for details.
"""
function mb01rw! end
"""
Compute either the upper or lower triangular part of one of the
matrix formulas
`_`
`R = alpha*R + beta*op( A )*B, (1)`
`_`
`R = alpha*R + beta*B*op( A ), (2)`
`_`
where alpha and beta are scalars, R and R are m-by-m matrices,
op( A ) and B are m-by-n and n-by-m matrices for (1), or n-by-m
and m-by-n matrices for (2), respectively, and op( A ) is one of
`op( A ) = A or op( A ) = A', the transpose of A.`
The result is overwritten on R.
See the SLICOT documentation for details.
"""
function mb01rx! end
"""
Compute either the upper or lower triangular part of one of the
matrix formulas
`_`
`R = alpha*R + beta*op( H )*B, (1)`
`_`
`R = alpha*R + beta*B*op( H ), (2)`
`_`
where alpha and beta are scalars, H, B, R, and R are m-by-m
matrices, H is an upper Hessenberg matrix, and op( H ) is one of
`op( H ) = H or op( H ) = H', the transpose of H.`
The result is overwritten on R.
See the SLICOT documentation for details.
"""
function mb01ry! end
"""
Scale a general M-by-N matrix A using the row and column
scaling factors in the vectors R and C.
See the SLICOT documentation for details.
"""
function mb01sd! end
"""
Scale a symmetric N-by-N matrix A using the row and column
scaling factors stored in the vector D.
See the SLICOT documentation for details.
"""
function mb01ss! end
"""
Compute the matrix product A * B, where A and B are upper
quasi-triangular matrices (that is, block upper triangular with
1-by-1 or 2-by-2 diagonal blocks) with the same structure.
The result is returned in the array B.
See the SLICOT documentation for details.
"""
function mb01td! end
"""
Compute one of the matrix products
`B = alpha*op( H ) * A, or B = alpha*A * op( H ),`
where alpha is a scalar, A and B are m-by-n matrices, H is an
upper Hessenberg matrix, and op( H ) is one of
`op( H ) = H or op( H ) = H', the transpose of H.`
See the SLICOT documentation for details.
"""
function mb01ud! end
"""
Compute one of the matrix products
`A : = alpha*op( H ) * A, or A : = alpha*A * op( H ),`
where alpha is a scalar, A is an m-by-n matrix, H is an upper
Hessenberg matrix, and op( H ) is one of
`op( H ) = H or op( H ) = H', the transpose of H.`
See the SLICOT documentation for details.
"""
function mb01uw! end
"""
Compute one of the matrix products
`A : = alpha*op( T ) * A, or A : = alpha*A * op( T ),`
where alpha is a scalar, A is an m-by-n matrix, T is a quasi-
triangular matrix, and op( T ) is one of
`op( T ) = T or op( T ) = T', the transpose of T.`
See the SLICOT documentation for details.
"""
function mb01ux! end
"""
Perform the following matrix operation
`C = alpha*kron( op(A), op(B) ) + beta*C,`
where alpha and beta are real scalars, op(M) is either matrix M or
its transpose, M', and kron( X, Y ) denotes the Kronecker product
of the matrices X and Y.
See the SLICOT documentation for details.
"""
function mb01vd! end
"""
Compute the matrix formula
_
R = alpha*( op( A )'*op( T )'*op( T ) + op( T )'*op( T )*op( A ) )
`+ beta*R, (1)`
if DICO = 'C', or
_
R = alpha*( op( A )'*op( T )'*op( T )*op( A ) - op( T )'*op( T ))
`+ beta*R, (2)`
`_`
if DICO = 'D', where alpha and beta are scalars, R, and R are
symmetric matrices, T is a triangular matrix, A is a general or
Hessenberg matrix, and op( M ) is one of
`op( M ) = M or op( M ) = M'.`
The result is overwritten on R.
See the SLICOT documentation for details.
"""
function mb01wd! end
"""
Compute the matrix product U' * U or L * L', where U and L are
upper and lower triangular matrices, respectively, stored in the
corresponding upper or lower triangular part of the array A.
If UPLO = 'U' then the upper triangle of the result is stored,
overwriting the matrix U in A.
If UPLO = 'L' then the lower triangle of the result is stored,
overwriting the matrix L in A.
See the SLICOT documentation for details.
"""
function mb01xd! end
"""
Compute the matrix product U' * U or L * L', where U and L are
upper and lower triangular matrices, respectively, stored in the
corresponding upper or lower triangular part of the array A.
If UPLO = 'U' then the upper triangle of the result is stored,
overwriting the matrix U in A.
If UPLO = 'L' then the lower triangle of the result is stored,
overwriting the matrix L in A.
See the SLICOT documentation for details.
"""
function mb01xy! end
"""
Perform the symmetric rank k operations
`C := alpha*op( A )*op( A )' + beta*C,`
where alpha and beta are scalars, C is an n-by-n symmetric matrix,
op( A ) is an n-by-k matrix, and op( A ) is one of
`op( A ) = A or op( A ) = A'.`
The matrix A has l nonzero codiagonals, either upper or lower.
See the SLICOT documentation for details.
"""
function mb01yd! end
"""
Compute the matrix product
`H := alpha*op( T )*H, or H := alpha*H*op( T ),`
where alpha is a scalar, H is an m-by-n upper or lower
Hessenberg-like matrix (with l nonzero subdiagonals or
superdiagonals, respectively), T is a unit, or non-unit,
upper or lower triangular matrix, and op( T ) is one of
`op( T ) = T or op( T ) = T'.`
See the SLICOT documentation for details.
"""
function mb01zd! end
"""
Compute the Cholesky factor and the generator and/or the
Cholesky factor of the inverse of a symmetric positive definite
(s.p.d.) block Toeplitz matrix T, defined by either its first
block row, or its first block column, depending on the routine
parameter TYPET. Transformation information is stored.
See the SLICOT documentation for details.
"""
function mb02cd! end
"""
Bring the first blocks of a generator to proper form.
The positive part of the generator is contained in the arrays A1
and A2. The negative part of the generator is contained in B.
Transformation information will be stored and can be applied
via SLICOT Library routine MB02CV.
See the SLICOT documentation for details.
"""
function mb02cu! end
"""
Apply the transformations created by the SLICOT Library routine
MB02CU on other columns / rows of the generator, contained in the
arrays F1, F2 and G.
See the SLICOT documentation for details.
"""
function mb02cv! end
"""
Bring the first blocks of a generator in proper form.
The columns / rows of the positive and negative generators
are contained in the arrays A and B, respectively.
Transformation information will be stored and can be applied
via SLICOT Library routine MB02CY.
See the SLICOT documentation for details.
"""
function mb02cx! end
"""
Apply the transformations created by the SLICOT Library
routine MB02CX on other columns / rows of the generator,
contained in the arrays A and B of positive and negative
generators, respectively.
See the SLICOT documentation for details.
"""
function mb02cy! end
"""
Update the Cholesky factor and the generator and/or the
Cholesky factor of the inverse of a symmetric positive definite
(s.p.d.) block Toeplitz matrix T, given the information from
a previous factorization and additional blocks in TA of its first
block row, or its first block column, depending on the routine
parameter TYPET. Transformation information is stored.
See the SLICOT documentation for details.
"""
function mb02dd! end
"""
Solve a system of linear equations T*X = B or X*T = B with
a symmetric positive definite (s.p.d.) block Toeplitz matrix T.
T is defined either by its first block row or its first block
column, depending on the parameter TYPET.
See the SLICOT documentation for details.
"""
function mb02ed! end
"""
Compute the incomplete Cholesky (ICC) factor of a symmetric
positive definite (s.p.d.) block Toeplitz matrix T, defined by
either its first block row, or its first block column, depending
on the routine parameter TYPET.
By subsequent calls of this routine, further rows / columns of
the Cholesky factor can be added.
Furthermore, the generator of the Schur complement of the leading
(P+S)*K-by-(P+S)*K block in T is available, which can be used,
e.g., for measuring the quality of the ICC factorization.
See the SLICOT documentation for details.
"""
function mb02fd! end
"""
Compute the Cholesky factor of a banded symmetric positive
definite (s.p.d.) block Toeplitz matrix, defined by either its
first block row, or its first block column, depending on the
routine parameter TYPET.
By subsequent calls of this routine the Cholesky factor can be
computed block column by block column.
See the SLICOT documentation for details.
"""
function mb02gd! end
"""
Compute, for a banded K*M-by-L*N block Toeplitz matrix T with
block size (K,L), specified by the nonzero blocks of its first
block column TC and row TR, a LOWER triangular matrix R (in band
storage scheme) such that
`T T`
`T T = R R . (1)`
It is assumed that the first MIN(M*K, N*L) columns of T are
linearly independent.
By subsequent calls of this routine, the matrix R can be computed
block column by block column.
See the SLICOT documentation for details.
"""
function mb02hd! end
"""
Solve the overdetermined or underdetermined real linear systems
involving an M*K-by-N*L block Toeplitz matrix T that is specified
by its first block column and row. It is assumed that T has full
rank.
The following options are provided:
1. If JOB = 'O' or JOB = 'A' : find the least squares solution of
`an overdetermined system, i.e., solve the least squares problem`
`minimize || B - T*X ||. (1)`
2. If JOB = 'U' or JOB = 'A' : find the minimum norm solution of
`the undetermined system`
`T`
`T * X = C. (2)`
See the SLICOT documentation for details.
"""
function mb02id! end
"""
Compute a lower triangular matrix R and a matrix Q with
Q^T Q = I such that
`T`
`T = Q R ,`
where T is a K*M-by-L*N block Toeplitz matrix with blocks of size
(K,L). The first column of T will be denoted by TC and the first
row by TR. It is assumed that the first MIN(M*K, N*L) columns of T
have full rank.
By subsequent calls of this routine the factors Q and R can be
computed block column by block column.
See the SLICOT documentation for details.
"""
function mb02jd! end
"""
Compute a low rank QR factorization with column pivoting of a
K*M-by-L*N block Toeplitz matrix T with blocks of size (K,L);
specifically,
`T`
`T P = Q R ,`
where R is lower trapezoidal, P is a block permutation matrix
and Q^T Q = I. The number of columns in R is equivalent to the
numerical rank of T with respect to the given tolerance TOL1.
Note that the pivoting scheme is local, i.e., only columns
belonging to the same block in T are permuted.
See the SLICOT documentation for details.
"""
function mb02jx! end
"""
Compute the matrix product
`C = alpha*op( T )*B + beta*C,`
where alpha and beta are scalars and T is a block Toeplitz matrix
specified by its first block column TC and first block row TR;
B and C are general matrices of appropriate dimensions.
See the SLICOT documentation for details.
"""
function mb02kd! end
"""
Solve the Total Least Squares (TLS) problem using a Singular
Value Decomposition (SVD) approach.
The TLS problem assumes an overdetermined set of linear equations
AX = B, where both the data matrix A as well as the observation
matrix B are inaccurate. The routine also solves determined and
underdetermined sets of equations by computing the minimum norm
solution.
It is assumed that all preprocessing measures (scaling, coordinate
transformations, whitening, ... ) of the data have been performed
in advance.
See the SLICOT documentation for details.
"""
function mb02md! end
"""
Solve the Total Least Squares (TLS) problem using a Partial
Singular Value Decomposition (PSVD) approach.
The TLS problem assumes an overdetermined set of linear equations
AX = B, where both the data matrix A as well as the observation
matrix B are inaccurate. The routine also solves determined and
underdetermined sets of equations by computing the minimum norm
solution.
It is assumed that all preprocessing measures (scaling, coordinate
transformations, whitening, ... ) of the data have been performed
in advance.
See the SLICOT documentation for details.
"""
function mb02nd! end
"""
Separate a zero singular value of a bidiagonal submatrix of
order k, k <= p, of the bidiagonal matrix
`|Q(1) E(1) 0 ... 0 |`
`| 0 Q(2) E(2) . |`
`J = | . . |`
`| . E(p-1)|`
`| 0 ... ... ... Q(p) |`
with p = MIN(M,N), by annihilating one or two superdiagonal
elements E(i-1) (if i > 1) and/or E(i) (if i < k).
See the SLICOT documentation for details.
"""
function mb02ny! end
"""
Solve (if well-conditioned) one of the matrix equations
`op( A )*X = alpha*B, or X*op( A ) = alpha*B,`
where alpha is a scalar, X and B are m-by-n matrices, A is a unit,
or non-unit, upper or lower triangular matrix and op( A ) is one
of
`op( A ) = A or op( A ) = A'.`
An estimate of the reciprocal of the condition number of the
triangular matrix A, in either the 1-norm or the infinity-norm, is
also computed as
`RCOND = 1 / ( norm(A) * norm(inv(A)) ).`
and the specified matrix equation is solved only if RCOND is
larger than a given tolerance TOL. In that case, the matrix X is
overwritten on B.
See the SLICOT documentation for details.
"""
function mb02od! end
"""
Solve (if well-conditioned) the matrix equations
`op( A )*X = B,`
where X and B are N-by-NRHS matrices, A is an N-by-N matrix and
op( A ) is one of
`op( A ) = A or op( A ) = A'.`
Error bounds on the solution and a condition estimate are also
provided.
See the SLICOT documentation for details.
"""
function mb02pd! end
"""
Compute a solution, optionally corresponding to specified free
elements, to a real linear least squares problem:
`minimize || A * X - B ||`
using a complete orthogonal factorization of the M-by-N matrix A,
which may be rank-deficient.
Several right hand side vectors b and solution vectors x can be
handled in a single call; they are stored as the columns of the
M-by-NRHS right hand side matrix B and the N-by-NRHS solution
matrix X.
See the SLICOT documentation for details.
"""
function mb02qd! end
"""
Determine the minimum-norm solution to a real linear least
squares problem:
`minimize || A * X - B ||,`
using the rank-revealing QR factorization of a real general
M-by-N matrix A, computed by SLICOT Library routine MB03OD.
See the SLICOT documentation for details.
"""
function mb02qy! end
"""
Solve a system of linear equations
`H * X = B or H' * X = B`
with an upper Hessenberg N-by-N matrix H using the LU
factorization computed by MB02SD.
See the SLICOT documentation for details.
"""
function mb02rd! end
"""
Solve a system of linear equations
`H * X = B, H' * X = B or H**H * X = B`
with a complex upper Hessenberg N-by-N matrix H using the LU
factorization computed by MB02SZ.
See the SLICOT documentation for details.
"""
function mb02rz! end
"""
Compute an LU factorization of an n-by-n upper Hessenberg
matrix H using partial pivoting with row interchanges.
See the SLICOT documentation for details.
"""
function mb02sd! end
"""
Compute an LU factorization of a complex n-by-n upper
Hessenberg matrix H using partial pivoting with row interchanges.
See the SLICOT documentation for details.
"""
function mb02sz! end
"""
Estimate the reciprocal of the condition number of an upper
Hessenberg matrix H, in either the 1-norm or the infinity-norm,
using the LU factorization computed by MB02SD.
See the SLICOT documentation for details.
"""
function mb02td! end
"""
Estimate the reciprocal of the condition number of a complex
upper Hessenberg matrix H, in either the 1-norm or the
infinity-norm, using the LU factorization computed by MB02SZ.
See the SLICOT documentation for details.
"""
function mb02tz! end
"""
Compute the minimum norm least squares solution of one of the
following linear systems
`op(R)*X = alpha*B, (1)`
`X*op(R) = alpha*B, (2)`
where alpha is a real scalar, op(R) is either R or its transpose,
R', R is an L-by-L real upper triangular matrix, B is an M-by-N
real matrix, and L = M for (1), or L = N for (2). Singular value
decomposition, R = Q*S*P', is used, assuming that R is rank
deficient.
See the SLICOT documentation for details.
"""
function mb02ud! end
"""
Solve for x in A * x = scale * RHS, using the LU factorization
of the N-by-N matrix A computed by SLICOT Library routine MB02UV.
The factorization has the form A = P * L * U * Q, where P and Q
are permutation matrices, L is unit lower triangular and U is
upper triangular.
See the SLICOT documentation for details.
"""
function mb02uu! end
"""
Compute an LU factorization, using complete pivoting, of the
N-by-N matrix A. The factorization has the form A = P * L * U * Q,
where P and Q are permutation matrices, L is lower triangular with
unit diagonal elements and U is upper triangular.
See the SLICOT documentation for details.
"""
function mb02uv! end
"""
Solve a system of the form A X = s B or A' X = s B with
possible scaling ("s") and perturbation of A. (A' means
A-transpose.) A is an N-by-N real matrix, and X and B are
N-by-M matrices. N may be 1 or 2. The scalar "s" is a scaling
factor (.LE. 1), computed by this subroutine, which is so chosen
that X can be computed without overflow. X is further scaled if
necessary to assure that norm(A)*norm(X) is less than overflow.
See the SLICOT documentation for details.
"""
function mb02uw! end
"""
Compute the solution to a real system of linear equations
`X * op(A) = B,`
where op(A) is either A or its transpose, A is an N-by-N matrix,
and X and B are M-by-N matrices.
The LU decomposition with partial pivoting and row interchanges,
A = P * L * U, is used, where P is a permutation matrix, L is unit
lower triangular, and U is upper triangular.
See the SLICOT documentation for details.
"""
function mb02vd! end
"""
Determine a vector x which solves the system of linear
equations
`A*x = b , D*x = 0 ,`
in the least squares sense, where A is an m-by-n matrix,
D is an n-by-n diagonal matrix, and b is an m-vector.
It is assumed that a QR factorization, with column pivoting, of A
is available, that is, A*P = Q*R, where P is a permutation matrix,
Q has orthogonal columns, and R is an upper triangular matrix
with diagonal elements of nonincreasing magnitude.
The routine needs the full upper triangle of R, the permutation
matrix P, and the first n components of Q'*b (' denotes the
transpose). The system A*x = b, D*x = 0, is then equivalent to
`R*z = Q'*b , P'*D*P*z = 0 , (1)`
where x = P*z. If this system does not have full rank, then a
least squares solution is obtained. On output, MB02YD also
provides an upper triangular matrix S such that
`P'*(A'*A + D*D)*P = S'*S .`
The system (1) is equivalent to S*z = c , where c contains the
first n components of the vector obtained by applying to
[ (Q'*b)' 0 ]' the transformations which triangularized
[ R' P'*D*P ]', getting S.
See the SLICOT documentation for details.
"""
function mb02yd! end
"""
Compute two Givens rotations (C1,S1) and (C2,S2) such that the
orthogonal matrix
`[ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ]`
`Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ],`
`[ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ]`
makes the first column of the real Wilkinson double shift
polynomial of the product of matrices in periodic upper Hessenberg
form, stored in the array A, parallel to the first unit vector.
Only the rotation defined by C1 and S1 is needed for the real
Wilkinson single shift polynomial (see the SLICOT Library routines
MB03BE or MB03BF). The shifts are defined based on the eigenvalues
(computed externally by the SLICOT Library routine MB03BB) of the
trailing 2-by-2 submatrix of the matrix product. See the
definitions of the arguments W1 and W2.
See the SLICOT documentation for details.
"""
function mb03ab! end
"""
Compute two Givens rotations (C1,S1) and (C2,S2) such that the
orthogonal matrix
`[ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ]`
`Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ],`
`[ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ]`
makes the first column of the real Wilkinson double shift
polynomial of the product of matrices in periodic upper Hessenberg
form, stored in the array A, parallel to the first unit vector.
Only the rotation defined by C1 and S1 is used for the real
Wilkinson single shift polynomial (see SLICOT Library routine
MB03BE).
See the SLICOT documentation for details.
"""
function mb03ad! end
"""
Compute two Givens rotations (C1,S1) and (C2,S2) such that the
orthogonal matrix
`[ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ]`
`Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ],`
`[ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ]`
makes the first column of the real Wilkinson double shift
polynomial of the product of matrices in periodic upper Hessenberg
form, stored in the array A, parallel to the first unit vector.
Only the rotation defined by C1 and S1 is used for the real
Wilkinson single shift polynomial (see SLICOT Library routines
MB03BE or MB03BF). All factors whose exponents differ from that of
the Hessenberg factor are assumed nonsingular. The trailing 2-by-2
submatrix and the five nonzero elements in the first two columns
of the matrix product are evaluated when a double shift is used.
See the SLICOT documentation for details.
"""
function mb03ae! end
"""
Compute two Givens rotations (C1,S1) and (C2,S2) such that the
orthogonal matrix
`[ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ]`
`Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ],`
`[ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ]`
makes the first column of the real Wilkinson double shift
polynomial of the product of matrices in periodic upper Hessenberg
form, stored in the array A, parallel to the first unit vector.
Only the rotation defined by C1 and S1 is used for the real
Wilkinson single shift polynomial (see SLICOT Library routines
MB03BE or MB03BF).
See the SLICOT documentation for details.
"""
function mb03af! end
"""
Compute two Givens rotations (C1,S1) and (C2,S2) such that the
orthogonal matrix
`[ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ]`
`Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ],`
`[ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ]`
makes the first column of the real Wilkinson double shift
polynomial of the product of matrices in periodic upper Hessenberg
form, stored in the array A, parallel to the first unit vector.
Only the rotation defined by C1 and S1 is used for the real
Wilkinson single shift polynomial (see SLICOT Library routines
MB03BE or MB03BF). All factors whose exponents differ from that of
the Hessenberg factor are assumed nonsingular. The matrix product
is evaluated.
See the SLICOT documentation for details.
"""
function mb03ag! end
"""
Compute two Givens rotations (C1,S1) and (C2,S2) such that the
orthogonal matrix
`[ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ]`
`Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ],`
`[ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ]`
makes the first column of the real Wilkinson double shift
polynomial of the product of matrices in periodic upper Hessenberg
form, stored in the array A, parallel to the first unit vector.
Only the rotation defined by C1 and S1 is used for the real
Wilkinson single shift polynomial (see SLICOT Library routines
MB03BE or MB03BF). All factors whose exponents differ from that of
the Hessenberg factor are assumed nonsingular. The trailing 2-by-2
submatrix and the five nonzero elements in the first two columns
of the matrix product are evaluated when a double shift is used.
See the SLICOT documentation for details.
"""
function mb03ah! end
"""
Compute two Givens rotations (C1,S1) and (C2,S2)
such that the orthogonal matrix
`[ Q 0 ] [ C1 S1 0 ] [ 1 0 0 ]`
`Z = [ ], Q := [ -S1 C1 0 ] * [ 0 C2 S2 ],`
`[ 0 I ] [ 0 0 1 ] [ 0 -S2 C2 ]`
makes the first column of the real Wilkinson double shift
polynomial of the product of matrices in periodic upper Hessenberg
form, stored in the array A, parallel to the first unit vector.
Only the rotation defined by C1 and S1 is used for the real
Wilkinson single shift polynomial (see SLICOT Library routines
MB03BE or MB03BF). All factors whose exponents differ from that of
the Hessenberg factor are assumed nonsingular. The matrix product
is evaluated.
See the SLICOT documentation for details.
"""
function mb03ai! end
"""
Compute the suitable maps for Hessenberg index H and
signature array S. Auxiliary routine for the periodic QZ
algorithms.
See the SLICOT documentation for details.
"""
function mb03ba! end
"""
Compute the eigenvalues of a general 2-by-2 matrix product via
a complex single shifted periodic QZ algorithm.
See the SLICOT documentation for details.
"""
function mb03bb! end
"""
Compute the product singular value decomposition of the K-1
triangular factors corresponding to a 2-by-2 product of K
factors in upper Hessenberg-triangular form.
For a general product of 2-by-2 triangular matrices
`S(2) S(3) S(K)`
`A = A(:,:,2) A(:,:,3) ... A(:,:,K),`
Givens rotations are computed so that
`S(i)`
`[ CV(i-1) SV(i-1) ] [ A(1,1,i)(in) A(1,2,i)(in) ]`
`[ -SV(i-1) CV(i-1) ] [ 0 A(2,2,i)(in) ]`
`S(i)`
`[ A(1,1,i)(out) A(1,2,i)(out) ] [ CV(i) SV(i) ]`
= [ 0 A(2,2,i)(out) ] [ -SV(i) CV(i) ]
stays upper triangular and
`[ CV(1) SV(1) ] [ CV(K) -SV(K) ]`
`[ -SV(1) CV(1) ] * A * [ SV(K) CV(K) ]`
is diagonal.
See the SLICOT documentation for details.
"""
function mb03bc! end
"""
Find the eigenvalues of the generalized matrix product
`S(1) S(2) S(K)`
`A(:,:,1) * A(:,:,2) * ... * A(:,:,K)`
where A(:,:,H) is upper Hessenberg and A(:,:,i), i <> H, is upper
triangular, using a double-shift version of the periodic
QZ method. In addition, A may be reduced to periodic Schur form:
A(:,:,H) is upper quasi-triangular and all the other factors
A(:,:,I) are upper triangular. Optionally, the 2-by-2 triangular
matrices corresponding to 2-by-2 diagonal blocks in A(:,:,H)
are so reduced that their product is a 2-by-2 diagonal matrix.
If COMPQ = 'U' or COMPQ = 'I', then the orthogonal factors are
computed and stored in the array Q so that for S(I) = 1,
`T`
`Q(:,:,I)(in) A(:,:,I)(in) Q(:,:,MOD(I,K)+1)(in)`
`T (1)`
`= Q(:,:,I)(out) A(:,:,I)(out) Q(:,:,MOD(I,K)+1)(out),`
and for S(I) = -1,
`T`
`Q(:,:,MOD(I,K)+1)(in) A(:,:,I)(in) Q(:,:,I)(in)`
`T (2)`
`= Q(:,:,MOD(I,K)+1)(out) A(:,:,I)(out) Q(:,:,I)(out).`
A partial generation of the orthogonal factors can be realized
via the array QIND.
See the SLICOT documentation for details.
"""
function mb03bd! end
"""
Apply at most 20 iterations of a real single shifted
periodic QZ algorithm to the 2-by-2 product of matrices stored
in the array A.
See the SLICOT documentation for details.
"""
function mb03be! end
"""
Apply at most 20 iterations of a real single shifted
periodic QZ algorithm to the 2-by-2 product of matrices stored
in the array A. The Hessenberg matrix is the last one of the
formal matrix product.
See the SLICOT documentation for details.
"""
function mb03bf! end
"""
Compute the eigenvalues of the 2-by-2 trailing submatrix of the
matrix product
`S(1) S(2) S(K)`
`A(:,:,1) * A(:,:,2) * ... * A(:,:,K)`
where A(:,:,AMAP(K)) is upper Hessenberg and A(:,:,AMAP(i)),
1 <= i < K, is upper triangular. All factors to be inverted
(depending on S and SINV) are assumed nonsingular. Moreover,
AMAP(K) is either 1 or K.
See the SLICOT documentation for details.
"""
function mb03bg! end
"""
Find the eigenvalues of the complex generalized matrix product
`S(1) S(2) S(K)`
`A(:,:,1) * A(:,:,2) * ... * A(:,:,K) , S(1) = 1,`
where A(:,:,1) is upper Hessenberg and A(:,:,i) is upper
triangular, i = 2, ..., K, using a single-shift version of the
periodic QZ method. In addition, A may be reduced to periodic
Schur form by unitary transformations: all factors A(:,:,i) become
upper triangular.
If COMPQ = 'V' or COMPQ = 'I', then the unitary factors are
computed and stored in the array Q so that for S(I) = 1,
`H`
`Q(:,:,I)(in) A(:,:,I)(in) Q(:,:,MOD(I,K)+1)(in)`
`H (1)`
`= Q(:,:,I)(out) A(:,:,I)(out) Q(:,:,MOD(I,K)+1)(out),`
and for S(I) = -1,
`H`
`Q(:,:,MOD(I,K)+1)(in) A(:,:,I)(in) Q(:,:,I)(in)`
`H (2)`
`= Q(:,:,MOD(I,K)+1)(out) A(:,:,I)(out) Q(:,:,I)(out).`
See the SLICOT documentation for details.
"""
function mb03bz! end
"""
Compute orthogonal matrices Q1, Q2, Q3 for a real 2-by-2,
3-by-3, or 4-by-4 regular block upper triangular pencil
`( A11 A12 ) ( B11 B12 ) ( D11 D12 )`
`aAB - bD = a ( ) ( ) - b ( ), (1)`
`( 0 A22 ) ( 0 B22 ) ( 0 D22 )`
such that the pencil a(Q3' A Q2 )(Q2' B Q1 ) - b(Q3' D Q1) is
still in block upper triangular form, but the eigenvalues in
Spec(A11 B11, D11), Spec(A22 B22, D22) are exchanged, where
Spec(X,Y) denotes the spectrum of the matrix pencil (X,Y), and M'
denotes the transpose of the matrix M.
Optionally, to upper triangularize the real regular pencil in
block lower triangular form
`( A11 0 ) ( B11 0 ) ( D11 0 )`
aAB - bD = a ( ) ( ) - b ( ), (2)
`( A21 A22 ) ( B21 B22 ) ( D21 D22 )`
while keeping the eigenvalues in the same diagonal position.
See the SLICOT documentation for details.
"""
function mb03cd! end
"""
Compute unitary matrices Q1, Q2, and Q3 for a complex 2-by-2
regular pencil aAB - bD, with A, B, D upper triangular, such that
Q3' A Q2, Q2' B Q1, Q3' D Q1 are still upper triangular, but the
eigenvalues are in reversed order. The matrices Q1, Q2, and Q3 are
represented by
`( CO1 SI1 ) ( CO2 SI2 ) ( CO3 SI3 )`
Q1 = ( ), Q2 = ( ), Q3 = ( ).
`( -SI1' CO1 ) ( -SI2' CO2 ) ( -SI3' CO3 )`
The notation M' denotes the conjugate transpose of the matrix M.
See the SLICOT documentation for details.
"""
function mb03cz! end
"""
Compute orthogonal matrices Q1 and Q2 for a real 2-by-2,
3-by-3, or 4-by-4 regular block upper triangular pencil
`( A11 A12 ) ( B11 B12 )`
`aA - bB = a ( ) - b ( ), (1)`
`( 0 A22 ) ( 0 B22 )`
such that the pencil a(Q2' A Q1) - b(Q2' B Q1) is still in block
upper triangular form, but the eigenvalues in Spec(A11, B11),
Spec(A22, B22) are exchanged, where Spec(X,Y) denotes the spectrum
of the matrix pencil (X,Y) and the notation M' denotes the
transpose of the matrix M.
Optionally, to upper triangularize the real regular pencil in
block lower triangular form
`( A11 0 ) ( B11 0 )`
`aA - bB = a ( ) - b ( ), (2)`
`( A21 A22 ) ( B21 B22 )`
while keeping the eigenvalues in the same diagonal position.
See the SLICOT documentation for details.
"""
function mb03dd! end
"""
Compute unitary matrices Q1 and Q2 for a complex 2-by-2 regular
pencil aA - bB with A, B upper triangular, such that
Q2' (aA - bB) Q1 is still upper triangular but the eigenvalues are
in reversed order. The matrices Q1 and Q2 are represented by
`( CO1 SI1 ) ( CO2 SI2 )`
Q1 = ( ), Q2 = ( ).
`( -SI1' CO1 ) ( -SI2' CO2 )`
The notation M' denotes the conjugate transpose of the matrix M.
See the SLICOT documentation for details.
"""
function mb03dz! end
"""
Compute orthogonal matrices Q1, Q2, Q3 for a real 2-by-2 or
4-by-4 regular pencil
`( A11 0 ) ( B11 0 ) ( 0 D12 )`
`aAB - bD = a ( ) ( ) - b ( ), (1)`
`( 0 A22 ) ( 0 B22 ) ( D21 0 )`
such that Q3' A Q2 and Q2' B Q1 are upper triangular, Q3' D Q1 is
upper quasi-triangular, and the eigenvalues with negative real
parts (if there are any) are allocated on the top. The notation M'
denotes the transpose of the matrix M. The submatrices A11, A22,
B11, B22 and D12 are upper triangular. If D21 is 2-by-2, then all
other blocks are nonsingular and the product
`-1 -1 -1 -1`
A22 D21 B11 A11 D12 B22 has a pair of complex conjugate
eigenvalues.
See the SLICOT documentation for details.
"""
function mb03ed! end
"""
Compute orthogonal matrices Q1 and Q2 for a real 2-by-2 or
4-by-4 regular pencil
`( A11 0 ) ( 0 B12 )`
`aA - bB = a ( ) - b ( ), (1)`
`( 0 A22 ) ( B21 0 )`
such that Q2' A Q1 is upper triangular, Q2' B Q1 is upper quasi-
triangular, and the eigenvalues with negative real parts (if there
are any) are allocated on the top. The notation M' denotes the
transpose of the matrix M. The submatrices A11, A22, and B12 are
upper triangular. If B21 is 2-by-2, then all the other blocks are
`-1 -1`
nonsingular and the product A11 B12 A22 B21 has a pair of
complex conjugate eigenvalues.
See the SLICOT documentation for details.
"""
function mb03fd! end
"""
Compute the eigenvalues of a complex N-by-N skew-Hamiltonian/
Hamiltonian pencil aS - bH, with
`( B F ) ( Z11 Z12 )`
`S = J Z' J' Z and H = ( ), Z = ( ),`
`( G -B' ) ( Z21 Z22 )`
`(1)`
`( 0 I )`
`J = ( ).`
`( -I 0 )`
The structured Schur form of the embedded real skew-Hamiltonian/
skew-Hamiltonian pencil, a`B_S` - b`B_T`, with `B_S` = J `B_Z`' J' `B_Z`,
`( Re(Z11) -Im(Z11) | Re(Z12) -Im(Z12) )`
`( | )`
`( Im(Z11) Re(Z11) | Im(Z12) Re(Z12) )`
`( | )`
`B_Z = (---------------------+---------------------) ,`
`( | )`
`( Re(Z21) -Im(Z21) | Re(Z22) -Im(Z22) )`
`( | )`
`( Im(Z21) Re(Z21) | Im(Z22) Re(Z22) )`
`(2)`
`( -Im(B) -Re(B) | -Im(F) -Re(F) )`
`( | )`
`( Re(B) -Im(B) | Re(F) -Im(F) )`
`( | )`
`B_T = (-----------------+-----------------) , T = i*H,`
`( | )`
`( -Im(G) -Re(G) | -Im(B') Re(B') )`
`( | )`
`( Re(G) -Im(G) | -Re(B') -Im(B') )`
is determined and used to compute the eigenvalues. Optionally, if
COMPQ = 'C', an orthonormal basis of the right deflating subspace,
Def_-(S, H), of the pencil aS - bH in (1), corresponding to the
eigenvalues with strictly negative real part, is computed. Namely,
after transforming a`B_S` - b`B_H`, in the factored form, by unitary
matrices, we have `B_S`out = J `B_Z`out' J' `B_Z`out,
`( BA BD ) ( BB BF )`
`B_Zout = ( ) and B_Hout = ( ), (3)`
`( 0 BC ) ( 0 -BB' )`
and the eigenvalues with strictly negative real part of the
complex pencil a`B_S`out - b`B_H`out are moved to the top. The
notation M' denotes the conjugate transpose of the matrix M.
Optionally, if COMPU = 'C', an orthonormal basis of the companion
subspace, range(P_U) [1], which corresponds to the eigenvalues
with negative real part, is computed. The embedding doubles the
multiplicities of the eigenvalues of the pencil aS - bH.
See the SLICOT documentation for details.
"""
function mb03fz! end
"""
Compute an orthogonal matrix Q and an orthogonal symplectic
matrix U for a real regular 2-by-2 or 4-by-4 skew-Hamiltonian/
Hamiltonian pencil a J B' J' B - b D with
`( B11 B12 ) ( D11 D12 ) ( 0 I )`
`B = ( ), D = ( ), J = ( ),`
`( 0 B22 ) ( 0 -D11' ) ( -I 0 )`
such that J Q' J' D Q and U' B Q keep block triangular form, but
the eigenvalues are reordered. The notation M' denotes the
transpose of the matrix M.
See the SLICOT documentation for details.
"""
function mb03gd! end
"""
Compute a unitary matrix Q and a unitary symplectic matrix U
for a complex regular 2-by-2 skew-Hamiltonian/Hamiltonian pencil
aS - bH with S = J Z' J' Z, where
`( Z11 Z12 ) ( H11 H12 )`
`Z = ( ) and H = ( ),`
`( 0 Z22 ) ( 0 -H11' )`
such that U' Z Q, (J Q J' )' H Q are both upper triangular, but the
eigenvalues of (J Q J')' ( aS - bH ) Q are in reversed order.
The matrices Q and U are represented by
`( CO1 SI1 ) ( CO2 SI2 )`
`Q = ( ) and U = ( ), respectively.`
`( -SI1' CO1 ) ( -SI2' CO2 )`
The notation M' denotes the conjugate transpose of the matrix M.
See the SLICOT documentation for details.
"""
function mb03gz! end
"""
Determine an orthogonal matrix Q, for a real regular 2-by-2 or
4-by-4 skew-Hamiltonian/Hamiltonian pencil
`( A11 A12 ) ( B11 B12 )`
`aA - bB = a ( ) - b ( )`
`( 0 A11' ) ( 0 -B11' )`
in structured Schur form, such that J Q' J' (aA - bB) Q is still
in structured Schur form but the eigenvalues are exchanged. The
notation M' denotes the transpose of the matrix M.
See the SLICOT documentation for details.
"""
function mb03hd! end
"""
Compute a unitary matrix Q for a complex regular 2-by-2
skew-Hamiltonian/Hamiltonian pencil aS - bH with
`( S11 S12 ) ( H11 H12 )`
S = ( ), H = ( ),
`( 0 S11' ) ( 0 -H11' )`
such that J Q' J' (aS - bH) Q is upper triangular but the
eigenvalues are in reversed order. The matrix Q is represented by
`( CO SI )`
Q = ( ).
`( -SI' CO )`
The notation M' denotes the conjugate transpose of the matrix M.
See the SLICOT documentation for details.
"""
function mb03hz! end
"""
Move the eigenvalues with strictly negative real parts of an
N-by-N real skew-Hamiltonian/Hamiltonian pencil aS - bH in
structured Schur form, with
`( 0 I ) ( A D ) ( B F )`
`S = J Z' J' Z, J = ( ), Z = ( ), H = ( ),`
`( -I 0 ) ( 0 C ) ( 0 -B' )`
to the leading principal subpencil, while keeping the triangular
form. Above, A is upper triangular, B is upper quasi-triangular,
and C is lower triangular.
The matrices Z and H are transformed by an orthogonal symplectic
matrix U and an orthogonal matrix Q such that
`( Aout Dout )`
`Zout = U' Z Q = ( ), and`
`( 0 Cout )`
`(1)`
`( Bout Fout )`
`Hout = J Q' J' H Q = ( ),`
`( 0 -Bout' )`
where Aout, Bout and Cout remain in triangular form. The notation
M' denotes the transpose of the matrix M.
Optionally, if COMPQ = 'I' or COMPQ = 'U', the orthogonal matrix Q
that fulfills (1) is computed.
Optionally, if COMPU = 'I' or COMPU = 'U', the orthogonal
symplectic matrix
`( U1 U2 )`
`U = ( )`
`( -U2 U1 )`
that fulfills (1) is computed.
See the SLICOT documentation for details.
"""
function mb03id! end
"""
Move the eigenvalues with strictly negative real parts of an
N-by-N complex skew-Hamiltonian/Hamiltonian pencil aS - bH in
structured Schur form, with
`( 0 I )`
`S = J Z' J' Z, where J = ( ),`
`( -I 0 )`
to the leading principal subpencil, while keeping the triangular
form. On entry, we have
`( A D ) ( B F )`
`Z = ( ), H = ( ),`
`( 0 C ) ( 0 -B' )`
where A and B are upper triangular and C is lower triangular.
Z and H are transformed by a unitary symplectic matrix U and a
unitary matrix Q such that
`( Aout Dout )`
`Zout = U' Z Q = ( ), and`
`( 0 Cout )`
`(1)`
`( Bout Fout )`
`Hout = J Q' J' H Q = ( ), `
`( 0 -Bout' )`
where Aout, Bout and Cout remain in triangular form. The notation
M' denotes the conjugate transpose of the matrix M.
Optionally, if COMPQ = 'I' or COMPQ = 'U', the unitary matrix Q
that fulfills (1) is computed.
Optionally, if COMPU = 'I' or COMPU = 'U', the unitary symplectic
matrix
`( U1 U2 )`
`U = ( )`
`( -U2 U1 ) `
that fulfills (1) is computed.
See the SLICOT documentation for details.
"""
function mb03iz! end
"""
Move the eigenvalues with strictly negative real parts of an
N-by-N real skew-Hamiltonian/Hamiltonian pencil aS - bH in
structured Schur form,
`( A D ) ( B F )`
`S = ( ), H = ( ),`
`( 0 A' ) ( 0 -B' )`
with A upper triangular and B upper quasi-triangular, to the
leading principal subpencil, while keeping the triangular form.
The notation M' denotes the transpose of the matrix M.
The matrices S and H are transformed by an orthogonal matrix Q
such that
`( Aout Dout ) `
`Sout = J Q' J' S Q = ( ),`
`( 0 Aout' ) `
`(1)`
`( Bout Fout ) ( 0 I )`
`Hout = J Q' J' H Q = ( ), with J = ( ),`
`( 0 -Bout' ) ( -I 0 )`
where Aout is upper triangular and Bout is upper quasi-triangular.
Optionally, if COMPQ = 'I' or COMPQ = 'U', the orthogonal matrix Q
that fulfills (1), is computed.
See the SLICOT documentation for details.
"""
function mb03jd! end
"""
Move the eigenvalues with strictly negative real parts of an
N-by-N real skew-Hamiltonian/Hamiltonian pencil aS - bH in
structured Schur form,
`( A D ) ( B F )`
`S = ( ), H = ( ),`
`( 0 A' ) ( 0 -B' )`
with A upper triangular and B upper quasi-triangular, to the
leading principal subpencil, while keeping the triangular form.
The notation M' denotes the transpose of the matrix M.
The matrices S and H are transformed by an orthogonal matrix Q
such that
`( Aout Dout ) `
`Sout = J Q' J' S Q = ( ),`
`( 0 Aout' ) `
`(1)`
`( Bout Fout ) ( 0 I )`
`Hout = J Q' J' H Q = ( ), with J = ( ),`
`( 0 -Bout' ) ( -I 0 )`
where Aout is upper triangular and Bout is upper quasi-triangular.
Optionally, if COMPQ = 'I' or COMPQ = 'U', the orthogonal matrix Q
that fulfills (1), is computed.
See the SLICOT documentation for details.
"""
function mb03jp! end
"""
Move the eigenvalues with strictly negative real parts of an
N-by-N complex skew-Hamiltonian/Hamiltonian pencil aS - bH in
structured Schur form to the leading principal subpencil, while
keeping the triangular form. On entry, we have
`( A D ) ( B F )`
`S = ( ), H = ( ),`
`( 0 A' ) ( 0 -B' )`
where A and B are upper triangular.
S and H are transformed by a unitary matrix Q such that
`( Aout Dout )`
`Sout = J Q' J' S Q = ( ), and`
`( 0 Aout' )`
`(1)`
`( Bout Fout ) ( 0 I )`
`Hout = J Q' J' H Q = ( ), with J = ( ),`
`( 0 -Bout' ) ( -I 0 )`
where Aout and Bout remain in upper triangular form. The notation
M' denotes the conjugate transpose of the matrix M.
Optionally, if COMPQ = 'I' or COMPQ = 'U', the unitary matrix Q
that fulfills (1) is computed.
See the SLICOT documentation for details.
"""
function mb03jz! end
"""
Reorder the diagonal blocks of the formal matrix product
`T22_K^S(K) * T22_K-1^S(K-1) * ... * T22_1^S(1), (1)`
of length K, in the generalized periodic Schur form
`[ T11_k T12_k T13_k ]`
`T_k = [ 0 T22_k T23_k ], k = 1, ..., K, (2)`
`[ 0 0 T33_k ]`
where
- the submatrices T11_k are NI(k+1)-by-NI(k), if S(k) = 1, or
`NI(k)-by-NI(k+1), if S(k) = -1, and contain dimension-induced`
`infinite eigenvalues,`
- the submatrices T22_k are NC-by-NC and contain core eigenvalues,
`which are generically neither zero nor infinite,`
- the submatrices T33_k contain dimension-induced zero
`eigenvalues,`
such that the block with starting row index IFST in (1) is moved
to row index ILST. The indices refer to the T22_k submatrices.
Optionally, the transformation matrices `Q_1`,...,`Q_K` from the
reduction into generalized periodic Schur form are updated with
respect to the performed reordering.
See the SLICOT documentation for details.
"""
function mb03ka! end
"""
Reorder the diagonal blocks of the formal matrix product
`T22_K^S(K) * T22_K-1^S(K-1) * ... * T22_1^S(1) (1)`
of length K in the generalized periodic Schur form
`[ T11_k T12_k T13_k ]`
`T_k = [ 0 T22_k T23_k ], k = 1, ..., K, (2)`
`[ 0 0 T33_k ]`
where
- the submatrices T11_k are NI(k+1)-by-NI(k), if S(k) = 1, or
`NI(k)-by-NI(k+1), if S(k) = -1, and contain dimension-induced`
`infinite eigenvalues,`
- the submatrices T22_k are NC-by-NC and contain core eigenvalues,
`which are generically neither zero nor infinite,`
- the submatrices T33_k contain dimension-induced zero
`eigenvalues,`
such that pairs of adjacent diagonal blocks of sizes 1 and/or 2 in
the product (1) are swapped.
Optionally, the transformation matrices `Q_1`,...,`Q_K` from the
reduction into generalized periodic Schur form are updated with
respect to the performed reordering.
See the SLICOT documentation for details.
"""
function mb03kb! end
"""
Reduce a 2-by-2 general, formal matrix product A of length K,
`A_K^s(K) * A_K-1^s(K-1) * ... * A_1^s(1),`
to the periodic Hessenberg-triangular form using a K-periodic
sequence of elementary reflectors (Householder matrices). The
matrices A_k, k = 1, ..., K, are stored in the N-by-N-by-K array A
starting in the R-th row and column, and N can be 3 or 4.
Each elementary reflector H_k is represented as
`H_k = I - tau_k * v_k * v_k', (1)`
where I is the 2-by-2 identity, tau_k is a real scalar, and v_k is
a vector of length 2, k = 1,...,K, and it is constructed such that
the following holds for k = 1,...,K:
`H_{k+1} * A_k * H_k = T_k, if s(k) = 1,`
`(2)`
`H_k * A_k * H_{k+1} = T_k, if s(k) = -1,`
with H_{K+1} = `H_1` and all `T_k` upper triangular except for
T_{khess} which is full. Clearly,
`T_K^s(K) *...* T_1^s(1) = H_1 * A_K^s(K) *...* A_1^s(1) * H_1.`
The reflectors are suitably applied to the whole, extended N-by-N
matrices `Ae_k`, not only to the submatrices `A_k`, k = 1, ..., K.
See the SLICOT documentation for details.
"""
function mb03kc! end
"""
Reorder the diagonal blocks of the formal matrix product
`T22_K^S(K) * T22_K-1^S(K-1) * ... * T22_1^S(1), (1)`
of length K, in the generalized periodic Schur form,
`[ T11_k T12_k T13_k ]`
`T_k = [ 0 T22_k T23_k ], k = 1, ..., K, (2)`
`[ 0 0 T33_k ]`
where
- the submatrices T11_k are NI(k+1)-by-NI(k), if S(k) = 1, or
`NI(k)-by-NI(k+1), if S(k) = -1, and contain dimension-induced`
`infinite eigenvalues,`
- the submatrices T22_k are NC-by-NC and contain core eigenvalues,
`which are generically neither zero nor infinite,`
- the submatrices T33_k contain dimension-induced zero
`eigenvalues,`
such that the M selected eigenvalues pointed to by the logical
vector SELECT end up in the leading part of the matrix sequence
T22_k.
Given that N(k) = N(k+1) for all k where S(k) = -1, the T11_k are
void and the first M columns of the updated orthogonal
transformation matrix sequence `Q_1`, ..., `Q_K` span a periodic
deflating subspace corresponding to the same eigenvalues.
See the SLICOT documentation for details.
"""
function mb03kd! end
"""
Solve small periodic Sylvester-like equations (PSLE)
`op(A(i))*X( i ) + isgn*X(i+1)*op(B(i)) = -scale*C(i), S(i) = 1,`
`op(A(i))*X(i+1) + isgn*X( i )*op(B(i)) = -scale*C(i), S(i) = -1.`
i = 1, ..., K, where op(A) means A or A**T, for the K-periodic
matrix sequence X(i) = X(i+K), where A, B and C are K-periodic
matrix sequences and A and B are in periodic real Schur form. The
matrices A(i) are M-by-M and B(i) are N-by-N, with 1 <= M, N <= 2.
See the SLICOT documentation for details.
"""
function mb03ke! end
"""
Compute the relevant eigenvalues of a real N-by-N skew-
Hamiltonian/Hamiltonian pencil aS - bH, with
`( A D ) ( B F )`
`S = ( ) and H = ( ), (1)`
`( E A' ) ( G -B' )`
where the notation M' denotes the transpose of the matrix M.
Optionally, if COMPQ = 'C', an orthogonal basis of the right
deflating subspace of aS - bH corresponding to the eigenvalues
with strictly negative real part is computed.
See the SLICOT documentation for details.
"""
function mb03ld! end
"""
Compute the relevant eigenvalues of a real N-by-N skew-
Hamiltonian/Hamiltonian pencil aS - bH, with
`( B F ) ( 0 I )`
`S = T Z = J Z' J' Z and H = ( ), J = ( ), (1)`
`( G -B' ) ( -I 0 )`
where the notation M' denotes the transpose of the matrix M.
Optionally, if COMPQ = 'C', an orthogonal basis of the right
deflating subspace of aS - bH corresponding to the eigenvalues
with strictly negative real part is computed. Optionally, if
COMPU = 'C', an orthonormal basis of the companion subspace,
range(P_U) [1], which corresponds to the eigenvalues with strictly
negative real part, is computed.
See the SLICOT documentation for details.
"""
function mb03lf! end
"""
Compute the relevant eigenvalues of a real N-by-N skew-
Hamiltonian/Hamiltonian pencil aS - bH, with
`( A D ) ( B F )`
`S = ( ) and H = ( ), (1)`
`( E A' ) ( G -B' )`
where the notation M' denotes the transpose of the matrix M.
Optionally, if COMPQ = 'C', an orthogonal basis of the right
deflating subspace of aS - bH corresponding to the eigenvalues
with strictly negative real part is computed.
See the SLICOT documentation for details.
"""
function mb03lp! end
"""
Compute the eigenvalues of a complex N-by-N skew-Hamiltonian/
Hamiltonian pencil aS - bH, with
`( A D ) ( B F )`
`S = ( ) and H = ( ). (1)`
`( E A' ) ( G -B' )`
The structured Schur form of the embedded real skew-Hamiltonian/
skew-Hamiltonian pencil a`B_S` - b`B_T`, defined as
`( Re(A) -Im(A) | Re(D) -Im(D) )`
`( | )`
`( Im(A) Re(A) | Im(D) Re(D) )`
`( | )`
`B_S = (-----------------+-----------------) , and`
`( | )`
`( Re(E) -Im(E) | Re(A') Im(A') )`
`( | )`
`( Im(E) Re(E) | -Im(A') Re(A') )`
`(2)`
`( -Im(B) -Re(B) | -Im(F) -Re(F) )`
`( | )`
`( Re(B) -Im(B) | Re(F) -Im(F) )`
`( | )`
`B_T = (-----------------+-----------------) , T = i*H,`
`( | )`
`( -Im(G) -Re(G) | -Im(B') Re(B') )`
`( | )`
`( Re(G) -Im(G) | -Re(B') -Im(B') )`
is determined and used to compute the eigenvalues. The notation M'
denotes the conjugate transpose of the matrix M. Optionally,
if COMPQ = 'C', an orthonormal basis of the right deflating
subspace of the pencil aS - bH, corresponding to the eigenvalues
with strictly negative real part, is computed. Namely, after
transforming a`B_S` - b`B_H` by unitary matrices, we have
`( BA BD ) ( BB BF )`
`B_Sout = ( ) and B_Hout = ( ), (3)`
`( 0 BA' ) ( 0 -BB' )`
and the eigenvalues with strictly negative real part of the
complex pencil a`B_S`out - b`B_H`out are moved to the top. The
embedding doubles the multiplicities of the eigenvalues of the
pencil aS - bH.
See the SLICOT documentation for details.
"""
function mb03lz! end
"""
Compute an upper bound THETA using a bisection method such that
the bidiagonal matrix
`|q(1) e(1) 0 ... 0 |`
`| 0 q(2) e(2) . |`
`J = | . . |`
`| . e(N-1)|`
`| 0 ... ... q(N) |`
has precisely L singular values less than or equal to THETA plus
a given tolerance TOL.
This routine is mainly intended to be called only by other SLICOT
routines.
See the SLICOT documentation for details.
"""
function mb03md! end
"""
Compute the absolute minimal value of NX elements in an array.
The function returns the value zero if NX < 1.
See the SLICOT documentation for details.
"""
function mb03my! end
"""
Find the number of singular values of the bidiagonal matrix
`|q(1) e(1) . ... 0 |`
`| 0 q(2) e(2) . |`
`J = | . . |`
`| . e(N-1)|`
`| 0 ... ... 0 q(N) |`
which are less than or equal to a given bound THETA.
This routine is intended to be called only by other SLICOT
routines.
See the SLICOT documentation for details.
"""
function mb03nd! end
"""
Compute the smallest singular value of A - jwI.
See the SLICOT documentation for details.
"""
function mb03ny! end
"""
Compute (optionally) a rank-revealing QR factorization of a
real general M-by-N matrix A, which may be rank-deficient,
and estimate its effective rank using incremental condition
estimation.
The routine uses a QR factorization with column pivoting:
`A * P = Q * R, where R = [ R11 R12 ],`
`[ 0 R22 ]`
with R11 defined as the largest leading submatrix whose estimated
condition number is less than 1/RCOND. The order of R11, RANK,
is the effective rank of A.
MB03OD does not perform any scaling of the matrix A.
See the SLICOT documentation for details.
"""
function mb03od! end
"""
Compute a rank-revealing QR factorization of a real general
M-by-N matrix A, which may be rank-deficient, and estimate its
effective rank using incremental condition estimation.
The routine uses a truncated QR factorization with column pivoting
`[ R11 R12 ]`
`A * P = Q * R, where R = [ ],`
`[ 0 R22 ]`
with R11 defined as the largest leading upper triangular submatrix
whose estimated condition number is less than 1/RCOND. The order
of R11, RANK, is the effective rank of A. Condition estimation is
performed during the QR factorization process. Matrix R22 is full
(but of small norm), or empty.
MB03OY does not perform any scaling of the matrix A.
See the SLICOT documentation for details.
"""
function mb03oy! end
"""
Compute (optionally) a rank-revealing RQ factorization of a
real general M-by-N matrix A, which may be rank-deficient,
and estimate its effective rank using incremental condition
estimation.
The routine uses an RQ factorization with row pivoting:
`P * A = R * Q, where R = [ R11 R12 ],`
`[ 0 R22 ]`
with R22 defined as the largest trailing submatrix whose estimated
condition number is less than 1/RCOND. The order of R22, RANK,
is the effective rank of A.
MB03PD does not perform any scaling of the matrix A.
See the SLICOT documentation for details.
"""
function mb03pd! end
"""
Compute a rank-revealing RQ factorization of a real general
M-by-N matrix A, which may be rank-deficient, and estimate its
effective rank using incremental condition estimation.
The routine uses a truncated RQ factorization with row pivoting:
`[ R11 R12 ]`
`P * A = R * Q, where R = [ ],`
`[ 0 R22 ]`
with R22 defined as the largest trailing upper triangular
submatrix whose estimated condition number is less than 1/RCOND.
The order of R22, RANK, is the effective rank of A. Condition
estimation is performed during the RQ factorization process.
Matrix R11 is full (but of small norm), or empty.
MB03PY does not perform any scaling of the matrix A.
See the SLICOT documentation for details.
"""
function mb03py! end
"""
Reorder the diagonal blocks of a principal submatrix of an
upper quasi-triangular matrix A together with their eigenvalues by
constructing an orthogonal similarity transformation UT.
After reordering, the leading block of the selected submatrix of A
has eigenvalues in a suitably defined domain of interest, usually
related to stability/instability in a continuous- or discrete-time
sense.
See the SLICOT documentation for details.
"""
function mb03qd! end
"""
Reorder the diagonal blocks of a principal subpencil of an
upper quasi-triangular matrix pencil A-lambda*E together with
their generalized eigenvalues, by constructing orthogonal
similarity transformations UT and VT.
After reordering, the leading block of the selected subpencil of
A-lambda*E has generalized eigenvalues in a suitably defined
domain of interest, usually related to stability/instability in a
continuous- or discrete-time sense.
See the SLICOT documentation for details.
"""
function mb03qg! end
"""
Compute the eigenvalues of an upper quasi-triangular matrix
pencil.
See the SLICOT documentation for details.
"""
function mb03qv! end
"""
Compute the eigenvalues of a selected 2-by-2 diagonal block
pair of an upper quasi-triangular pencil, to reduce the selected
block pair to the standard form and to split it in the case of
real eigenvalues, by constructing orthogonal matrices UT and VT.
The transformations UT and VT are applied to the pair (A,E) by
computing (UT'*A*VT, UT'*E*VT ), to the matrices U and V,
by computing U*UT and V*VT.
See the SLICOT documentation for details.
"""
function mb03qw! end
"""
Compute the eigenvalues of an upper quasi-triangular matrix.
See the SLICOT documentation for details.
"""
function mb03qx! end
"""
Compute the eigenvalues of a selected 2-by-2 diagonal block
of an upper quasi-triangular matrix, to reduce the selected block
to the standard form and to split the block in the case of real
eigenvalues by constructing an orthogonal transformation UT.
This transformation is applied to A (by similarity) and to
another matrix U from the right.
See the SLICOT documentation for details.
"""
function mb03qy! end
"""
Reduce a matrix A in real Schur form to a block-diagonal form
using well-conditioned non-orthogonal similarity transformations.
The condition numbers of the transformations used for reduction
are roughly bounded by PMAX*PMAX, where PMAX is a given value.
The transformations are optionally postmultiplied in a given
matrix X. The real Schur form is optionally ordered, so that
clustered eigenvalues are grouped in the same block.
See the SLICOT documentation for details.
"""
function mb03rd! end
"""
Reorder the diagonal blocks of the principal submatrix between
the indices KL and KU (KU >= KL) of a real Schur form matrix A
together with their eigenvalues, using orthogonal similarity
transformations, such that the block specified by KU is moved in
the position KL. The transformations are optionally postmultiplied
in a given matrix X.
See the SLICOT documentation for details.
"""
function mb03rx! end
"""
Solve the Sylvester equation -AX + XB = C, where A and B are
M-by-M and N-by-N matrices, respectively, in real Schur form.
This routine is intended to be called only by SLICOT Library
routine MB03RD. For efficiency purposes, the computations are
aborted when the infinity norm of an elementary submatrix of X is
greater than a given value PMAX.
See the SLICOT documentation for details.
"""
function mb03ry! end
"""
Compute the eigenvalues of an N-by-N square-reduced Hamiltonian
matrix
`( A' G' )`
`H' = ( T ). (1)`
`( Q' -A' )`
Here, A' is an N-by-N matrix, and G' and Q' are symmetric N-by-N
matrices. It is assumed without a check that H' is square-
reduced, i.e., that
`2 ( A'' G'' )`
`H' = ( T ) with A'' upper Hessenberg. (2)`
`( 0 A'' )`
`T 2`
(Equivalently, Q'A'- A' Q' = 0, A'' = A' + G'Q', and for i > j+1,
`A''(i,j) = 0.) Ordinarily, H' is the output from SLICOT Library`
routine MB04ZD. The eigenvalues of H' are computed as the square
roots of the eigenvalues of A''.
See the SLICOT documentation for details.
"""
function mb03sd! end
"""
Reorder a matrix X in skew-Hamiltonian Schur form:
`[ A G ] T`
`X = [ T ], G = -G,`
`[ 0 A ]`
or in Hamiltonian Schur form:
`[ A G ] T`
`X = [ T ], G = G,`
`[ 0 -A ]`
where A is in upper quasi-triangular form, so that a selected
cluster of eigenvalues appears in the leading diagonal blocks
of the matrix A (in X) and the leading columns of [ U1; -U2 ] form
an orthonormal basis for the corresponding right invariant
subspace.
If X is skew-Hamiltonian, then each eigenvalue appears twice; one
copy corresponds to the j-th diagonal element and the other to the
(n+j)-th diagonal element of X. The logical array LOWER controls
which copy is to be reordered to the leading part of A.
If X is Hamiltonian then the eigenvalues appear in pairs
(lambda,-lambda); lambda corresponds to the j-th diagonal
element and -lambda to the (n+j)-th diagonal element of X.
The logical array LOWER controls whether lambda or -lambda is to
be reordered to the leading part of A.
The matrix A must be in Schur canonical form (as returned by the
LAPACK routine DHSEQR), that is, block upper triangular with
1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has
its diagonal elements equal and its off-diagonal elements of
opposite sign.
See the SLICOT documentation for details.
"""
function mb03td! end
"""
Swap diagonal blocks A11 and A22 of order 1 or 2 in the upper
quasi-triangular matrix A contained in a skew-Hamiltonian matrix
`[ A G ] T`
`X = [ T ], G = -G,`
`[ 0 A ]`
or in a Hamiltonian matrix
`[ A G ] T`
`X = [ T ], G = G.`
`[ 0 -A ]`
This routine is a modified version of the LAPACK subroutine
DLAEX2.
The matrix A must be in Schur canonical form (as returned by the
LAPACK routine DHSEQR), that is, block upper triangular with
1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has
its diagonal elements equal and its off-diagonal elements of
opposite sign.
See the SLICOT documentation for details.
"""
function mb03ts! end
"""
Compute all, or part, of the singular value decomposition of a
real upper triangular matrix.
The N-by-N upper triangular matrix A is factored as A = Q*S*P',
where Q and P are N-by-N orthogonal matrices and S is an
N-by-N diagonal matrix with non-negative diagonal elements,
SV(1), SV(2), ..., SV(N), ordered such that
`SV(1) >= SV(2) >= ... >= SV(N) >= 0.`
The columns of Q are the left singular vectors of A, the diagonal
elements of S are the singular values of A and the columns of P
are the right singular vectors of A.
Either or both of Q and P' may be requested.
When P' is computed, it is returned in A.
See the SLICOT documentation for details.
"""
function mb03ud! end
"""
Reduce a product of p real general matrices A = `A_1`*`A_2`*...*`A_p`
to upper Hessenberg form, H = `H_1`*`H_2`*...*`H_p`, where `H_1` is
upper Hessenberg, and `H_2`, ..., `H_p` are upper triangular, by using
orthogonal similarity transformations on A,
`Q_1' * A_1 * Q_2 = H_1,`
`Q_2' * A_2 * Q_3 = H_2,`
`...`
`Q_p' * A_p * Q_1 = H_p.`
See the SLICOT documentation for details.
"""
function mb03vd! end
"""
Generate the real orthogonal matrices `Q_1`, `Q_2`, ..., `Q_p`,
which are defined as the product of ihi-ilo elementary reflectors
of order n, as returned by SLICOT Library routine MB03VD:
`Q_j = H_j(ilo) H_j(ilo+1) . . . H_j(ihi-1).`
See the SLICOT documentation for details.
"""
function mb03vy! end
"""
Swap adjacent diagonal blocks A11*B11 and A22*B22 of size
1-by-1 or 2-by-2 in an upper (quasi) triangular matrix product
A*B by an orthogonal equivalence transformation.
(A, B) must be in periodic real Schur canonical form (as returned
by SLICOT Library routine MB03XP), i.e., A is block upper
triangular with 1-by-1 and 2-by-2 diagonal blocks, and B is upper
triangular.
Optionally, the matrices Q and Z of generalized Schur vectors are
updated.
`Q(in) * A(in) * Z(in)' = Q(out) * A(out) * Z(out)',`
`Z(in) * B(in) * Q(in)' = Z(out) * B(out) * Q(out)'.`
This routine is largely based on the LAPACK routine DTGEX2
developed by Bo Kagstrom and Peter Poromaa.
See the SLICOT documentation for details.
"""
function mb03wa! end
"""
Compute the Schur decomposition and the eigenvalues of a
product of matrices, H = `H_1`*`H_2`*...*`H_p`, with `H_1` an upper
Hessenberg matrix and `H_2`, ..., `H_p` upper triangular matrices,
without evaluating the product. Specifically, the matrices Z_i
are computed, such that
`Z_1' * H_1 * Z_2 = T_1,`
`Z_2' * H_2 * Z_3 = T_2,`
`...`
`Z_p' * H_p * Z_1 = T_p,`
where `T_1` is in real Schur form, and `T_2`, ..., `T_p` are upper
triangular.
The routine works primarily with the Hessenberg and triangular
submatrices in rows and columns ILO to IHI, but optionally applies
the transformations to all the rows and columns of the matrices
H_i, i = 1,...,p. The transformations can be optionally
accumulated.
See the SLICOT documentation for details.
"""
function mb03wd! end
"""
Compute the eigenvalues of a product of matrices,
T = `T_1`*`T_2`*...*`T_p`, where `T_1` is an upper quasi-triangular
matrix and `T_2`, ..., `T_p` are upper triangular matrices.
See the SLICOT documentation for details.
"""
function mb03wx! end
"""
Compute the eigenvalues of a Hamiltonian matrix,
`[ A G ] T T`
`H = [ T ], G = G, Q = Q, (1)`
`[ Q -A ]`
where A, G and Q are real n-by-n matrices.
Due to the structure of H all eigenvalues appear in pairs
(lambda,-lambda). This routine computes the eigenvalues of H
using an algorithm based on the symplectic URV and the periodic
Schur decompositions as described in [1],
`T [ T G ]`
`U H V = [ T ], (2)`
`[ 0 S ]`
where U and V are 2n-by-2n orthogonal symplectic matrices,
S is in real Schur form and T is upper triangular.
The algorithm is backward stable and preserves the eigenvalue
pairings in finite precision arithmetic.
Optionally, a symplectic balancing transformation to improve the
conditioning of eigenvalues is computed (see MB04DD). In this
case, the matrix H in decomposition (2) must be replaced by the
balanced matrix.
The SLICOT Library routine MB03ZD can be used to compute invariant
subspaces of H from the output of this routine.
See the SLICOT documentation for details.
"""
function mb03xd! end
"""
Compute the periodic Schur decomposition and the eigenvalues of
a product of matrices, H = A*B, with A upper Hessenberg and B
upper triangular without evaluating any part of the product.
Specifically, the matrices Q and Z are computed, so that
`Q' * A * Z = S, Z' * B * Q = T`
where S is in real Schur form, and T is upper triangular.
See the SLICOT documentation for details.
"""
function mb03xp! end
"""
Compute the eigenvalues and real skew-Hamiltonian Schur form of
a skew-Hamiltonian matrix,
`[ A G ]`
`W = [ T ],`
`[ Q A ]`
where A is an N-by-N matrix and G, Q are N-by-N skew-symmetric
matrices. Specifically, an orthogonal symplectic matrix U is
computed so that
`T [ Aout Gout ]`
`U W U = [ T ] ,`
`[ 0 Aout ]`
where Aout is in Schur canonical form (as returned by the LAPACK
routine DHSEQR). That is, Aout is block upper triangular with
1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has
its diagonal elements equal and its off-diagonal elements of
opposite sign.
Optionally, the matrix U is returned in terms of its first N/2
rows
`[ U1 U2 ]`
`U = [ ].`
`[ -U2 U1 ]`
See the SLICOT documentation for details.
"""
function mb03xs! end
"""
Reduce 2*nb columns and rows of a real (k+2n)-by-(k+2n)
matrix H:
`[ op(A) G ]`
`H = [ ],`
`[ Q op(B) ]`
so that elements in the first nb columns below the k-th
subdiagonal of the (k+n)-by-n matrix op(A), in the first nb
columns and rows of the n-by-n matrix Q and in the first nb rows
above the diagonal of the n-by-(k+n) matrix op(B) are zero.
The reduction is performed by orthogonal symplectic
transformations UU'*H*VV and matrices U, V, YA, YB, YG, YQ, XA,
XB, XG, and XQ are returned so that
`[ op(Aout)+U*YA'+XA*V' G+U*YG'+XG*V' ]`
`UU' H VV = [ ].`
`[ Qout+U*YQ'+XQ*V' op(Bout)+U*YB'+XB*V' ]`
This is an auxiliary routine called by MB04TB.
See the SLICOT documentation for details.
"""
function mb03xu! end
"""
Compute the eigenvalues of a Hamiltonian matrix,
`[ A G ] H H`
`H = [ H ], G = G , Q = Q , (1)`
`[ Q -A ]`
where A, G and Q are complex n-by-n matrices.
Due to the structure of H, if lambda is an eigenvalue, then
-conjugate(lambda) is also an eigenvalue. This does not mean that
purely imaginary eigenvalues are necessarily multiple. The routine
computes the eigenvalues of H using an embedding to a real skew-
Hamiltonian matrix He,
`[ Ae Ge ] T T`
`He = [ T ], Ge = -Ge , Qe = -Qe , (2)`
`[ Qe Ae ]`
where Ae, Ge, and Qe are real 2*n-by-2*n matrices, defined by
`[ Im(A) Re(A) ]`
`Ae = [ ],`
`[ -Re(A) Im(A) ]`
`[ triu(Im(G)) Re(G) ]`
`triu(Ge) = [ ],`
`[ 0 triu(Im(G)) ]`
`[ tril(Im(Q)) 0 ]`
`tril(Qe) = [ ], `
`[ -Re(Q) tril(Im(Q)) ]`
and triu and tril denote the upper and lower triangle,
respectively. Then, an orthogonal symplectic matrix Ue is used to
reduce He to the structured real Schur form
`T [ Se De ] T`
`Ue He Ue = [ T ], De = -De , (3)`
`[ 0 Se ]`
where Ue is a 4n-by-4n real symplectic matrix, and Se is upper
quasi-triangular (real Schur form).
Optionally, if JOB = 'S', or JOB = 'G', the matrix i*He is further
transformed to the structured complex Schur form
`H [ Sc Gc ] H`
`U (i*He) U = [ H ], Gc = Gc , (4)`
`[ 0 -Sc ]`
where U is a 4n-by-4n unitary symplectic matrix, and Sc is upper
triangular (Schur form).
The algorithm is backward stable and preserves the spectrum
structure in finite precision arithmetic.
Optionally, a symplectic balancing transformation to improve the
conditioning of eigenvalues is computed (see the SLICOT Library
routine MB04DZ). In this case, the matrix He in decompositions (3)
and (4) must be replaced by the balanced matrix.
See the SLICOT documentation for details.
"""
function mb03xz! end
"""
Annihilate one or two entries on the subdiagonal of the
Hessenberg matrix A for dealing with zero elements on the diagonal
of the triangular matrix B.
MB03YA is an auxiliary routine called by SLICOT Library routines
MB03XP and MB03YD.
See the SLICOT documentation for details.
"""
function mb03ya! end
"""
Deal with small subtasks of the product eigenvalue problem.
MB03YD is an auxiliary routine called by SLICOT Library routine
MB03XP.
See the SLICOT documentation for details.
"""
function mb03yd! end
"""
Compute the periodic Schur factorization of a real 2-by-2
matrix pair (A,B) where B is upper triangular. This routine
computes orthogonal (rotation) matrices given by CSL, SNL and CSR,
SNR such that
1) if the pair (A,B) has two real eigenvalues, then
`[ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ]`
`[ 0 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ]`
`[ b11 b12 ] := [ CSR SNR ] [ b11 b12 ] [ CSL -SNL ]`
`[ 0 b22 ] [ -SNR CSR ] [ 0 b22 ] [ SNL CSL ],`
2) if the pair (A,B) has a pair of complex conjugate eigenvalues,
`then`
`[ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ]`
`[ a21 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ]`
`[ b11 0 ] := [ CSR SNR ] [ b11 b12 ] [ CSL -SNL ]`
`[ 0 b22 ] [ -SNR CSR ] [ 0 b22 ] [ SNL CSL ].`
This is a modified version of the LAPACK routine DLAGV2 for
computing the real, generalized Schur decomposition of a
two-by-two matrix pencil.
See the SLICOT documentation for details.
"""
function mb03yt! end
"""
1. To compute, for a given matrix pair (A,B) in periodic Schur
`form, orthogonal matrices Ur and Vr so that`
`T [ A11 A12 ] T [ B11 B12 ]`
`Vr * A * Ur = [ ], Ur * B * Vr = [ ], (1)`
`[ 0 A22 ] [ 0 B22 ]`
`is in periodic Schur form, and the eigenvalues of A11*B11`
`form a selected cluster of eigenvalues.`
2. To compute an orthogonal matrix W so that
`T [ 0 -A11 ] [ R11 R12 ]`
`W * [ ] * W = [ ], (2)`
`[ B11 0 ] [ 0 R22 ]`
`where the eigenvalues of R11 and -R22 coincide and have`
`positive real part.`
Optionally, the matrix C is overwritten by Ur'*C*Vr.
All eigenvalues of A11*B11 must either be complex or real and
negative.
See the SLICOT documentation for details.
"""
function mb03za! end
"""
Compute the stable and unstable invariant subspaces for a
Hamiltonian matrix with no eigenvalues on the imaginary axis,
using the output of the SLICOT Library routine MB03XD.
See the SLICOT documentation for details.
"""
function mb03zd! end
"""
Compute the eigenvalues of a real N-by-N skew-Hamiltonian/
Hamiltonian pencil aS - bH with
`( 0 I )`
`S = T Z = J Z' J' Z, where J = ( ), (1)`
`( -I 0 )`
via generalized symplectic URV decomposition. That is, orthogonal
matrices Q1 and Q2 and orthogonal symplectic matrices U1 and U2
are computed such that
`( T11 T12 )`
`Q1' T U1 = Q1' J Z' J' U1 = ( ) = Tout,`
`( 0 T22 )`
`( Z11 Z12 )`
`U2' Z Q2 = ( ) = Zout, (2)`
`( 0 Z22 )`
`( H11 H12 )`
`Q1' H Q2 = ( ) = Hout,`
`( 0 H22 )`
where T11, T22', Z11, Z22', H11 are upper triangular and H22' is
upper quasi-triangular. The notation M' denotes the transpose of
the matrix M.
Optionally, if COMPQ1 = 'I' or COMPQ1 = 'U', the orthogonal
transformation matrix Q1 will be computed.
Optionally, if COMPQ2 = 'I' or COMPQ2 = 'U', the orthogonal
transformation matrix Q2 will be computed.
Optionally, if COMPU1 = 'I' or COMPU1 = 'U', the orthogonal
symplectic transformation matrix
`( U11 U12 )`
`U1 = ( )`
`( -U12 U11 )`
will be computed.
Optionally, if COMPU2 = 'I' or COMPU2 = 'U', the orthogonal
symplectic transformation matrix
`( U21 U22 )`
`U2 = ( )`
`( -U22 U21 )`
will be computed.
See the SLICOT documentation for details.
"""
function mb04ad! end
"""
Compute the eigenvalues of a complex N-by-N skew-Hamiltonian/
Hamiltonian pencil aS - bH, with
`H T ( B F ) ( Z11 Z12 )`
`S = J Z J Z and H = ( H ), Z =: ( ). (1)`
`( G -B ) ( Z21 Z22 )`
The structured Schur form of the embedded real skew-Hamiltonian/
`H T`
skew-Hamiltonian pencil, a`B_S` - b`B_T`, with `B_S` = J `B_Z` J `B_Z`,
`( Re(Z11) -Im(Z11) | Re(Z12) -Im(Z12) )`
`( | )`
`( Im(Z11) Re(Z11) | Im(Z12) Re(Z12) )`
`( | )`
`B_Z = (---------------------+---------------------) ,`
`( | )`
`( Re(Z21) -Im(Z21) | Re(Z22) -Im(Z22) )`
`( | )`
`( Im(Z21) Re(Z21) | Im(Z22) Re(Z22) )`
`(2)`
`( -Im(B) -Re(B) | -Im(F) -Re(F) )`
`( | )`
`( Re(B) -Im(B) | Re(F) -Im(F) )`
`( | )`
`B_T = (-----------------+-----------------) , T = i*H,`
`( | T T )`
`( -Im(G) -Re(G) | -Im(B ) Re(B ) )`
`( | T T )`
`( Re(G) -Im(G) | -Re(B ) -Im(B ) )`
is determined and used to compute the eigenvalues. Optionally,
if JOB = 'T', the pencil a`B_S` - b`B_H` is transformed by a unitary
matrix Q and a unitary symplectic matrix U to the structured Schur
`H T`
form a`B_S`out - b`B_H`out, with `B_S`out = J `B_Z`out J `B_Z`out,
`( BA BD ) ( BB BF )`
`B_Zout = ( ) and B_Hout = ( H ), (3)`
`( 0 BC ) ( 0 -BB )`
where BA and BB are upper triangular, BC is lower triangular,
and BF is Hermitian. `B_H` above is defined as `B_H` = -i*`B_T`.
The embedding doubles the multiplicities of the eigenvalues of
the pencil aS - bH.
Optionally, if COMPQ = 'C', the unitary matrix Q is computed.
Optionally, if COMPU = 'C', the unitary symplectic matrix U is
computed.
See the SLICOT documentation for details.
"""
function mb04az! end
"""
Compute the eigenvalues of a real N-by-N skew-Hamiltonian/
Hamiltonian pencil aS - bH with
`( A D ) ( C V )`
`S = ( ) and H = ( ). (1)`
`( E A' ) ( W -C' )`
Optionally, if JOB = 'T', decompositions of S and H will be
computed via orthogonal transformations Q1 and Q2 as follows:
`( Aout Dout )`
`Q1' S J Q1 J' = ( ),`
`( 0 Aout' )`
`( Bout Fout )`
`J' Q2' J S Q2 = ( ) =: T, (2)`
`( 0 Bout' )`
`( C1out Vout ) ( 0 I )`
`Q1' H Q2 = ( ), where J = ( )`
`( 0 C2out' ) ( -I 0 )`
and Aout, Bout, C1out are upper triangular, C2out is upper quasi-
triangular and Dout and Fout are skew-symmetric. The notation M'
denotes the transpose of the matrix M.
Optionally, if COMPQ1 = 'I' or COMPQ1 = 'U', then the orthogonal
transformation matrix Q1 will be computed.
Optionally, if COMPQ2 = 'I' or COMPQ2 = 'U', then the orthogonal
transformation matrix Q2 will be computed.
See the SLICOT documentation for details.
"""
function mb04bd! end
"""
Compute the eigenvalues of a real N-by-N skew-Hamiltonian/
Hamiltonian pencil aS - bH with
`( A D ) ( C V )`
`S = ( ) and H = ( ). (1)`
`( E A' ) ( W -C' )`
Optionally, if JOB = 'T', decompositions of S and H will be
computed via orthogonal transformations Q1 and Q2 as follows:
`( Aout Dout )`
`Q1' S J Q1 J' = ( ),`
`( 0 Aout' )`
`( Bout Fout )`
`J' Q2' J S Q2 = ( ) =: T, (2)`
`( 0 Bout' )`
`( C1out Vout ) ( 0 I )`
`Q1' H Q2 = ( ), where J = ( )`
`( 0 C2out' ) ( -I 0 )`
and Aout, Bout, C1out are upper triangular, C2out is upper quasi-
triangular and Dout and Fout are skew-symmetric. The notation M'
denotes the transpose of the matrix M.
Optionally, if COMPQ1 = 'I' or COMPQ1 = 'U', then the orthogonal
transformation matrix Q1 will be computed.
Optionally, if COMPQ2 = 'I' or COMPQ2 = 'U', then the orthogonal
transformation matrix Q2 will be computed.
See the SLICOT documentation for details.
"""
function mb04bp! end
"""
Compute the eigenvalues of a complex N-by-N skew-Hamiltonian/
Hamiltonian pencil aS - bH, with
`( A D ) ( B F )`
`S = ( H ) and H = ( H ). (1)`
`( E A ) ( G -B )`
This routine computes the eigenvalues using an embedding to a real
skew-Hamiltonian/skew-Hamiltonian pencil a`B_S` - b`B_T`, defined as
`( Re(A) -Im(A) | Re(D) -Im(D) )`
`( | )`
`( Im(A) Re(A) | Im(D) Re(D) )`
`( | )`
`B_S = (-----------------+-----------------) , and`
`( | T T )`
`( Re(E) -Im(E) | Re(A ) Im(A ) )`
`( | T T )`
`( Im(E) Re(E) | -Im(A ) Re(A ) )`
`(2)`
`( -Im(B) -Re(B) | -Im(F) -Re(F) )`
`( | )`
`( Re(B) -Im(B) | Re(F) -Im(F) )`
`( | )`
`B_T = (-----------------+-----------------) , T = i*H.`
`( | T T )`
`( -Im(G) -Re(G) | -Im(B ) Re(B ) )`
`( | T T )`
`( Re(G) -Im(G) | -Re(B ) -Im(B ) )`
Optionally, if JOB = 'T', the pencil a`B_S` - b`B_H` (`B_H` = -i*`B_T`) is
transformed by a unitary matrix Q to the structured Schur form
`( BA BD ) ( BB BF )`
`B_Sout = ( H ) and B_Hout = ( H ), (3)`
`( 0 BA ) ( 0 -BB )`
where BA and BB are upper triangular, BD is skew-Hermitian, and
BF is Hermitian. The embedding doubles the multiplicities of the
eigenvalues of the pencil aS - bH. Optionally, if COMPQ = 'C', the
unitary matrix Q is computed.
See the SLICOT documentation for details.
"""
function mb04bz! end
"""
Compute the transformed matrices A, B and D, using orthogonal
matrices Q1, Q2 and Q3 for a real N-by-N regular pencil
`( A11 0 ) ( B11 0 ) ( 0 D12 )`
`aA*B - bD = a ( ) ( ) - b ( ), (1)`
`( 0 A22 ) ( 0 B22 ) ( D21 0 )`
where A11, A22, B11, B22 and D12 are upper triangular, D21 is
upper quasi-triangular and the generalized matrix product
`-1 -1 -1 -1`
A11 D12 B22 A22 D21 B11 is upper quasi-triangular, such
that Q3' A Q2, Q2' B Q1 are upper triangular, Q3' D Q1 is upper
quasi-triangular and the transformed pencil
a(Q3' A B Q1) - b(Q3' D Q1) is in generalized Schur form. The
notation M' denotes the transpose of the matrix M.
See the SLICOT documentation for details.
"""
function mb04cd! end
"""
Apply from the left the inverse of a balancing transformation,
computed by the SLICOT Library routine MB04DP, to the matrix
`[ V1 ]`
`[ ],`
`[ sgn*V2 ]`
where sgn is either +1 or -1.
See the SLICOT documentation for details.
"""
function mb04db! end
"""
Balance a real Hamiltonian matrix,
`[ A G ]`
`H = [ T ] ,`
`[ Q -A ]`
where A is an N-by-N matrix and G, Q are N-by-N symmetric
matrices. This involves, first, permuting H by a symplectic
similarity transformation to isolate eigenvalues in the first
1:ILO-1 elements on the diagonal of A; and second, applying a
diagonal similarity transformation to rows and columns
ILO:N, N+ILO:2*N to make the rows and columns as close in 1-norm
as possible. Both steps are optional.
See the SLICOT documentation for details.
"""
function mb04dd! end
"""
Apply the inverse of a balancing transformation, computed by
the SLICOT Library routines MB04DD or MB04DS, to a 2*N-by-M matrix
`[ V1 ]`
`[ ],`
`[ sgn*V2 ]`
where sgn is either +1 or -1.
See the SLICOT documentation for details.
"""
function mb04di! end
"""
Balance a pair of N-by-N real matrices (A,B). This involves,
first, permuting A and B by equivalence transformations to isolate
eigenvalues in the first 1 to ILO-1 and last IHI+1 to N elements
on the diagonal of A and B; and second, applying a diagonal
equivalence transformation to rows and columns ILO to IHI to make
the rows and columns as close in 1-norm as possible. Both steps
are optional. Balancing may reduce the 1-norms of the matrices,
and improve the accuracy of the computed eigenvalues and/or
eigenvectors in the generalized eigenvalue problem
A*x = lambda*B*x.
This routine may optionally improve the conditioning of the
scaling transformation compared to the LAPACK routine DGGBAL.
See the SLICOT documentation for details.
"""
function mb04dl! end
"""
Balance the 2*N-by-2*N skew-Hamiltonian/Hamiltonian pencil
aS - bH, with
`( A D ) ( C V )`
`S = ( ) and H = ( ), A, C N-by-N, (1)`
`( E A' ) ( W -C' )`
where D and E are skew-symmetric, and V and W are symmetric
matrices. This involves, first, permuting aS - bH by a symplectic
equivalence transformation to isolate eigenvalues in the first
1:ILO-1 elements on the diagonal of A and C; and second, applying
a diagonal equivalence transformation to make the pairs of rows
and columns ILO:N and N+ILO:2*N as close in 1-norm as possible.
Both steps are optional. Balancing may reduce the 1-norms of the
matrices S and H.
See the SLICOT documentation for details.
"""
function mb04dp! end
"""
Balance a real skew-Hamiltonian matrix
`[ A G ]`
`S = [ T ] ,`
`[ Q A ]`
where A is an N-by-N matrix and G, Q are N-by-N skew-symmetric
matrices. This involves, first, permuting S by a symplectic
similarity transformation to isolate eigenvalues in the first
1:ILO-1 elements on the diagonal of A; and second, applying a
diagonal similarity transformation to rows and columns
ILO:N, N+ILO:2*N to make the rows and columns as close in 1-norm
as possible. Both steps are optional.
See the SLICOT documentation for details.
"""
function mb04ds! end
"""
Perform a symplectic scaling on the Hamiltonian matrix
`( A G )`
`H = ( T ), (1)`
`( Q -A )`
i.e., perform either the symplectic scaling transformation
`-1`
`( A' G' ) ( D 0 ) ( A G ) ( D 0 )`
`H' <-- ( T ) = ( ) ( T ) ( -1 ), (2)`
`( Q' -A' ) ( 0 D ) ( Q -A ) ( 0 D )`
where D is a diagonal scaling matrix, or the symplectic norm
scaling transformation
`( A'' G'' ) 1 ( A G/tau )`
`H'' <-- ( T ) = --- ( T ), (3)`
`( Q'' -A'' ) tau ( tau Q -A )`
where tau is a real scalar. Note that if tau is not equal to 1,
then (3) is NOT a similarity transformation. The eigenvalues
of H are then tau times the eigenvalues of H''.
For symplectic scaling (2), D is chosen to give the rows and
columns of A' approximately equal 1-norms and to give Q' and G'
approximately equal norms. (See METHOD below for details.) For
norm scaling, tau = MAX(1, ||A||, ||G||, ||Q||) where ||.||
denotes the 1-norm (column sum norm).
See the SLICOT documentation for details.
"""
function mb04dy! end
"""
Balance a complex Hamiltonian matrix,
`[ A G ]`
`H = [ H ] ,`
`[ Q -A ]`
where A is an N-by-N matrix and G, Q are N-by-N Hermitian
matrices. This involves, first, permuting H by a symplectic
similarity transformation to isolate eigenvalues in the first
1:ILO-1 elements on the diagonal of A; and second, applying a
diagonal similarity transformation to rows and columns
ILO:N, N+ILO:2*N to make the rows and columns as close in 1-norm
as possible. Both steps are optional. Assuming ILO = 1, let D be a
diagonal matrix of order N with the scaling factors on the
diagonal. The scaled Hamiltonian is defined by
`[ D**-1*A*D D**-1*G*D**-1 ]`
`Hs = [ H ] .`
`[ D*Q*D -D*A *D**-1 ]`
See the SLICOT documentation for details.
"""
function mb04dz! end
"""
Compute the eigenvalues of a real N-by-N skew-Hamiltonian/
skew-Hamiltonian pencil aS - bT with
`( B F ) ( 0 I )`
`S = J Z' J' Z and T = ( ), where J = ( ). (1)`
`( G B' ) ( -I 0 )`
Optionally, if JOB = 'T', the pencil aS - bT will be transformed
to the structured Schur form: an orthogonal transformation matrix
Q and an orthogonal symplectic transformation matrix U are
computed, such that
`( Z11 Z12 )`
`U' Z Q = ( ) = Zout, and`
`( 0 Z22 )`
`(2)`
`( Bout Fout )`
`J Q' J' T Q = ( ),`
`( 0 Bout' )`
where Z11 and Z22' are upper triangular and Bout is upper quasi-
triangular. The notation M' denotes the transpose of the matrix M.
Optionally, if COMPQ = 'I', the orthogonal transformation matrix Q
will be computed.
Optionally, if COMPU = 'I' or COMPU = 'U', the orthogonal
symplectic transformation matrix
`( U1 U2 )`
`U = ( )`
`( -U2 U1 )`
will be computed.
See the SLICOT documentation for details.
"""
function mb04ed! end
"""
Compute the eigenvalues of a real N-by-N skew-Hamiltonian/
skew-Hamiltonian pencil aS - bT with
`( A D ) ( B F )`
`S = ( ) and T = ( ). (1)`
`( E A' ) ( G B' )`
Optionally, if JOB = 'T', the pencil aS - bT will be transformed
to the structured Schur form: an orthogonal transformation matrix
Q is computed such that
`( Aout Dout )`
`J Q' J' S Q = ( ), and`
`( 0 Aout' )`
`(2)`
`( Bout Fout ) ( 0 I )`
`J Q' J' T Q = ( ), where J = ( ),`
`( 0 Bout' ) ( -I 0 )`
Aout is upper triangular, and Bout is upper quasi-triangular. The
notation M' denotes the transpose of the matrix M.
Optionally, if COMPQ = 'I' or COMPQ = 'U', the orthogonal
transformation matrix Q will be computed.
See the SLICOT documentation for details.
"""
function mb04fd! end
"""
Compute the eigenvalues of a real N-by-N skew-Hamiltonian/
skew-Hamiltonian pencil aS - bT with
`( A D ) ( B F )`
`S = ( ) and T = ( ). (1)`
`( E A' ) ( G B' )`
Optionally, if JOB = 'T', the pencil aS - bT will be transformed
to the structured Schur form: an orthogonal transformation matrix
Q is computed such that
`( Aout Dout )`
`J Q' J' S Q = ( ), and`
`( 0 Aout' )`
`(2)`
`( Bout Fout ) ( 0 I )`
`J Q' J' T Q = ( ), where J = ( ),`
`( 0 Bout' ) ( -I 0 )`
Aout is upper triangular, and Bout is upper quasi-triangular. The
notation M' denotes the transpose of the matrix M.
Optionally, if COMPQ = 'I' or COMPQ = 'U', the orthogonal
transformation matrix Q will be computed.
See the SLICOT documentation for details.
"""
function mb04fp! end
"""
Compute an RQ factorization with row pivoting of a
real m-by-n matrix A: P*A = R*Q.
See the SLICOT documentation for details.
"""
function mb04gd! end
"""
Compute the transformed matrices A and B, using orthogonal
matrices Q1 and Q2 for a real N-by-N regular pencil
`( A11 0 ) ( 0 B12 )`
`aA - bB = a ( ) - b ( ), (1)`
`( 0 A22 ) ( B21 0 )`
where A11, A22 and B12 are upper triangular, B21 is upper
quasi-triangular and the generalized matrix product
`-1 -1`
A11 B12 A22 B21 is in periodic Schur form, such that the
matrix Q2' A Q1 is upper triangular, Q2' B Q1 is upper
quasi-triangular and the transformed pencil
a(Q2' A Q1) - b(Q2' B Q1) is in generalized Schur form. The
notation M' denotes the transpose of the matrix M.
See the SLICOT documentation for details.
"""
function mb04hd! end
"""
Compute a QR factorization of an n-by-m matrix A (A = Q * R),
having a p-by-min(p,m) zero triangle in the lower left-hand side
corner, as shown below, for n = 8, m = 7, and p = 2:
`[ x x x x x x x ]`
`[ x x x x x x x ]`
`[ x x x x x x x ]`
`[ x x x x x x x ]`
`A = [ x x x x x x x ],`
`[ x x x x x x x ]`
`[ 0 x x x x x x ]`
`[ 0 0 x x x x x ]`
and optionally apply the transformations to an n-by-l matrix B
(from the left). The problem structure is exploited. This
computation is useful, for instance, in combined measurement and
time update of one iteration of the time-invariant Kalman filter
(square root information filter).
See the SLICOT documentation for details.
"""
function mb04id! end
"""
Overwrite the real n-by-m matrix C with Q' * C, Q * C,
C * Q', or C * Q, according to the following table
`SIDE = 'L' SIDE = 'R'`
TRANS = 'N': Q * C C * Q
TRANS = 'T': Q'* C C * Q'
where Q is a real orthogonal matrix defined as the product of
k elementary reflectors
`Q = H(1) H(2) . . . H(k)`
as returned by SLICOT Library routine MB04ID. Q is of order n
if SIDE = 'L' and of order m if SIDE = 'R'.
See the SLICOT documentation for details.
"""
function mb04iy! end
"""
Compute a QR factorization of an n-by-m matrix A (A = Q * R),
having a p-by-min(p,m) zero triangle in the lower left-hand side
corner, as shown below, for n = 8, m = 7, and p = 2:
`[ x x x x x x x ]`
`[ x x x x x x x ]`
`[ x x x x x x x ]`
`[ x x x x x x x ]`
`A = [ x x x x x x x ],`
`[ x x x x x x x ]`
`[ 0 x x x x x x ]`
`[ 0 0 x x x x x ]`
and optionally apply the transformations to an n-by-l matrix B
(from the left). The problem structure is exploited. This
computation is useful, for instance, in combined measurement and
time update of one iteration of the time-invariant Kalman filter
(square root information filter).
See the SLICOT documentation for details.
"""
function mb04iz! end
"""
Compute an LQ factorization of an n-by-m matrix A (A = L * Q),
having a min(n,p)-by-p zero triangle in the upper right-hand side
corner, as shown below, for n = 8, m = 7, and p = 2:
`[ x x x x x 0 0 ]`
`[ x x x x x x 0 ]`
`[ x x x x x x x ]`
`[ x x x x x x x ]`
`A = [ x x x x x x x ],`
`[ x x x x x x x ]`
`[ x x x x x x x ]`
`[ x x x x x x x ]`
and optionally apply the transformations to an l-by-m matrix B
(from the right). The problem structure is exploited. This
computation is useful, for instance, in combined measurement and
time update of one iteration of the time-invariant Kalman filter
(square root covariance filter).
See the SLICOT documentation for details.
"""
function mb04jd! end
"""
Calculate a QR factorization of the first block column and
apply the orthogonal transformations (from the left) also to the
second block column of a structured matrix, as follows
`_`
`[ R 0 ] [ R C ]`
`Q' * [ ] = [ ]`
`[ A B ] [ 0 D ]`
`_`
where R and R are upper triangular. The matrix A can be full or
upper trapezoidal/triangular. The problem structure is exploited.
This computation is useful, for instance, in combined measurement
and time update of one iteration of the Kalman filter (square
root information filter).
See the SLICOT documentation for details.
"""
function mb04kd! end
"""
Calculate an LQ factorization of the first block row and apply
the orthogonal transformations (from the right) also to the second
block row of a structured matrix, as follows
`_`
`[ L A ] [ L 0 ]`
`[ ]*Q = [ ]`
`[ 0 B ] [ C D ]`
`_`
where L and L are lower triangular. The matrix A can be full or
lower trapezoidal/triangular. The problem structure is exploited.
This computation is useful, for instance, in combined measurement
and time update of one iteration of the Kalman filter (square
root covariance filter).
See the SLICOT documentation for details.
"""
function mb04ld! end
"""
Reduce the 1-norm of a general real matrix A by balancing.
This involves diagonal similarity transformations applied
iteratively to A to make the rows and columns as close in norm as
possible.
This routine can be used instead LAPACK Library routine DGEBAL,
when no reduction of the 1-norm of the matrix is possible with
DGEBAL, as for upper triangular matrices. LAPACK Library routine
DGEBAK, with parameters ILO = 1, IHI = N, and JOB = 'S', should
be used to apply the backward transformation.
See the SLICOT documentation for details.
"""
function mb04md! end
"""
Calculate an RQ factorization of the first block row and
apply the orthogonal transformations (from the right) also to the
second block row of a structured matrix, as follows
`_`
`[ A R ] [ 0 R ]`
`[ ] * Q' = [ _ _ ]`
`[ C B ] [ C B ]`
`_`
where R and R are upper triangular. The matrix A can be full or
upper trapezoidal/triangular. The problem structure is exploited.
See the SLICOT documentation for details.
"""
function mb04nd! end
"""
Apply a real elementary reflector H to a real m-by-(n+1)
matrix C = [ A B ], from the right, where A has one column. H is
represented in the form
`( 1 )`
`H = I - tau * u *u', u = ( ),`
`( v )`
where tau is a real scalar and v is a real n-vector.
If tau = 0, then H is taken to be the unit matrix.
In-line code is used if H has order < 11.
See the SLICOT documentation for details.
"""
function mb04ny! end
"""
Calculate a QR factorization of the first block column and
apply the orthogonal transformations (from the left) also to the
second block column of a structured matrix, as follows
`_ _`
`[ R B ] [ R B ]`
`Q' * [ ] = [ _ ]`
`[ A C ] [ 0 C ]`
`_`
where R and R are upper triangular. The matrix A can be full or
upper trapezoidal/triangular. The problem structure is exploited.
See the SLICOT documentation for details.
"""
function mb04od! end
"""
Perform the QR factorization
`( U ) = Q*( R ), where U = ( U1 U2 ), R = ( R1 R2 ),`
`( x' ) ( 0 ) ( 0 T ) ( 0 R3 )`
where U and R are (m+n)-by-(m+n) upper triangular matrices, x is
an m+n element vector, U1 is m-by-m, T is n-by-n, stored
separately, and Q is an (m+n+1)-by-(m+n+1) orthogonal matrix.
The matrix ( U1 U2 ) must be supplied in the m-by-(m+n) upper
trapezoidal part of the array A and this is overwritten by the
corresponding part ( R1 R2 ) of R. The remaining upper triangular
part of R, R3, is overwritten on the array T.
The transformations performed are also applied to the (m+n+1)-by-p
matrix ( B' C' d )' (' denotes transposition), where B, C, and d'
are m-by-p, n-by-p, and 1-by-p matrices, respectively.
See the SLICOT documentation for details.
"""
function mb04ow! end
"""
Perform the QR factorization
`(U ) = Q*(R),`
`(x') (0)`
where U and R are n-by-n upper triangular matrices, x is an
n element vector and Q is an (n+1)-by-(n+1) orthogonal matrix.
U must be supplied in the n-by-n upper triangular part of the
array A and this is overwritten by R.
See the SLICOT documentation for details.
"""
function mb04ox! end
"""
Apply a real elementary reflector H to a real (m+1)-by-n
matrix C = [ A ], from the left, where A has one row. H is
`[ B ]`
represented in the form
`( 1 )`
`H = I - tau * u *u', u = ( ),`
`( v )`
where tau is a real scalar and v is a real m-vector.
If tau = 0, then H is taken to be the unit matrix.
In-line code is used if H has order < 11.
See the SLICOT documentation for details.
"""
function mb04oy! end
"""
Reduce a Hamiltonian like matrix
`[ A G ] T T`
`H = [ T ] , G = G , Q = Q,`
`[ Q -A ]`
or a skew-Hamiltonian like matrix
`[ A G ] T T`
`W = [ T ] , G = -G , Q = -Q,`
`[ Q A ]`
so that elements below the (k+1)-th subdiagonal in the first nb
columns of the (k+n)-by-n matrix A, and offdiagonal elements
in the first nb columns and rows of the n-by-n matrix Q are zero.
The reduction is performed by an orthogonal symplectic
transformation UU'*H*UU and matrices U, XA, XG, XQ, and YA are
returned so that
`[ Aout + U*XA'+ YA*U' Gout + U*XG'+ XG*U' ]`
`UU'*H*UU = [ ].`
`[ Qout + U*XQ'+ XQ*U' -Aout'- XA*U'- U*YA' ]`
Similarly,
`[ Aout + U*XA'+ YA*U' Gout + U*XG'- XG*U' ]`
`UU'*W*UU = [ ].`
`[ Qout + U*XQ'- XQ*U' Aout'+ XA*U'+ U*YA' ]`
This is an auxiliary routine called by MB04PB.
See the SLICOT documentation for details.
"""
function mb04pa! end
"""
Reduce a Hamiltonian matrix,
`[ A G ]`
`H = [ T ] ,`
`[ Q -A ]`
where A is an N-by-N matrix and G,Q are N-by-N symmetric matrices,
to Paige/Van Loan (PVL) form. That is, an orthogonal symplectic U
is computed so that
`T [ Aout Gout ]`
`U H U = [ T ] ,`
`[ Qout -Aout ]`
where Aout is upper Hessenberg and Qout is diagonal.
Blocked version.
See the SLICOT documentation for details.
"""
function mb04pb! end
"""
Reduce a Hamiltonian matrix,
`[ A G ]`
`H = [ T ] ,`
`[ Q -A ]`
where A is an N-by-N matrix and G,Q are N-by-N symmetric matrices,
to Paige/Van Loan (PVL) form. That is, an orthogonal symplectic U
is computed so that
`T [ Aout Gout ]`
`U H U = [ T ] ,`
`[ Qout -Aout ]`
where Aout is upper Hessenberg and Qout is diagonal.
Unblocked version.
See the SLICOT documentation for details.
"""
function mb04pu! end
"""
Apply a real elementary reflector H to a real m-by-n matrix
C, from either the left or the right. H is represented in the form
`( 1 )`
`H = I - tau * u *u', u = ( ),`
`( v )`
where tau is a real scalar and v is a real vector.
If tau = 0, then H is taken to be the unit matrix.
In-line code is used if H has order < 11.
See the SLICOT documentation for details.
"""
function mb04py! end
"""
Overwrite general real m-by-n matrices C and D, or their
transposes, with
`[ op(C) ]`
`Q * [ ] if TRANQ = 'N', or`
`[ op(D) ]`
`T [ op(C) ]`
`Q * [ ] if TRANQ = 'T',`
`[ op(D) ]`
where Q is defined as the product of symplectic reflectors and
Givens rotations,
`Q = diag( H(1),H(1) ) G(1) diag( F(1),F(1) )`
`diag( H(2),H(2) ) G(2) diag( F(2),F(2) )`
`....`
`diag( H(k),H(k) ) G(k) diag( F(k),F(k) ).`
Blocked version.
See the SLICOT documentation for details.
"""
function mb04qb! end
"""
Apply the orthogonal symplectic block reflector
`[ I+V*T*V' V*R*S*V' ]`
`Q = [ ]`
`[ -V*R*S*V' I+V*T*V' ]`
or its transpose to a real 2m-by-n matrix [ op(A); op(B) ] from
the left.
The k-by-k upper triangular blocks of the matrices
`[ S1 ] [ T11 T12 T13 ]`
`R = [ R1 R2 R3 ], S = [ S2 ], T = [ T21 T22 T23 ],`
`[ S3 ] [ T31 T32 T33 ]`
with R2 unit and S1, R3, T21, T31, T32 strictly upper triangular,
are stored rowwise in the arrays RS and T, respectively.
See the SLICOT documentation for details.
"""
function mb04qc! end
"""
Form the triangular block factors R, S and T of a symplectic
block reflector SH, which is defined as a product of 2k
concatenated Householder reflectors and k Givens rotations,
`SH = diag( H(1),H(1) ) G(1) diag( F(1),F(1) )`
`diag( H(2),H(2) ) G(2) diag( F(2),F(2) )`
`....`
`diag( H(k),H(k) ) G(k) diag( F(k),F(k) ).`
The upper triangular blocks of the matrices
`[ S1 ] [ T11 T12 T13 ]`
`R = [ R1 R2 R3 ], S = [ S2 ], T = [ T21 T22 T23 ],`
`[ S3 ] [ T31 T32 T33 ]`
with R2 unit and S1, R3, T21, T31, T32 strictly upper triangular,
are stored rowwise in the arrays RS and T, respectively.
See the SLICOT documentation for details.
"""
function mb04qf! end
"""
Overwrites general real m-by-n/n-by-m matrices C and D with
`[ op(C) ]`
`U * [ ] if TRANU = 'N', or`
`[ op(D) ]`
`T [ op(C) ]`
`U * [ ] if TRANU = 'T',`
`[ op(D) ]`
where U is defined as the product of symplectic reflectors and
Givens rotations,
`U = diag( H(1),H(1) ) G(1) diag( F(1),F(1) )`
`diag( H(2),H(2) ) G(2) diag( F(2),F(2) )`
`....`
`diag( H(k),H(k) ) G(k) diag( F(k),F(k) ),`
with k = m-1, as returned by the SLICOT Library routines MB04PU
or MB04RU.
See the SLICOT documentation for details.
"""
function mb04qs! end
"""
Overwrite general real m-by-n matrices C and D, or their
transposes, with
`[ op(C) ]`
`Q * [ ] if TRANQ = 'N', or`
`[ op(D) ]`
`T [ op(C) ]`
`Q * [ ] if TRANQ = 'T',`
`[ op(D) ]`
where Q is defined as the product of symplectic reflectors and
Givens rotations,
`Q = diag( H(1),H(1) ) G(1) diag( F(1),F(1) )`
`diag( H(2),H(2) ) G(2) diag( F(2),F(2) )`
`....`
`diag( H(k),H(k) ) G(k) diag( F(k),F(k) ).`
Unblocked version.
See the SLICOT documentation for details.
"""
function mb04qu! end
"""
Reduce a skew-Hamiltonian matrix,
`[ A G ]`
`W = [ T ] ,`
`[ Q A ]`
where A is an N-by-N matrix and G, Q are N-by-N skew-symmetric
matrices, to Paige/Van Loan (PVL) form. That is, an orthogonal
symplectic matrix U is computed so that
`T [ Aout Gout ]`
`U W U = [ T ] ,`
`[ 0 Aout ]`
where Aout is in upper Hessenberg form.
Blocked version.
See the SLICOT documentation for details.
"""
function mb04rb! end
"""
Reduce a skew-Hamiltonian matrix,
`[ A G ]`
`W = [ T ] ,`
`[ Q A ]`
where A is an N-by-N matrix and G, Q are N-by-N skew-symmetric
matrices, to Paige/Van Loan (PVL) form. That is, an orthogonal
symplectic matrix U is computed so that
`T [ Aout Gout ]`
`U W U = [ T ] ,`
`[ 0 Aout ]`
where Aout is in upper Hessenberg form.
Unblocked version.
See the SLICOT documentation for details.
"""
function mb04ru! end
"""
Compute a symplectic QR decomposition of a real 2M-by-N matrix
[A; B],
`[ A ] [ R11 R12 ]`
`[ ] = Q * R = Q [ ],`
`[ B ] [ R21 R22 ]`
where Q is a symplectic orthogonal matrix, R11 is upper triangular
and R21 is strictly upper triangular.
If [A; B] is symplectic then, theoretically, R21 = 0 and
R22 = inv(R11)^T. Unblocked version.
See the SLICOT documentation for details.
"""
function mb04su! end
"""
Compute a symplectic URV (SURV) decomposition of a real
2N-by-2N matrix H,
`[ op(A) G ] [ op(R11) R12 ]`
`H = [ ] = U R V' = U * [ ] * V' ,`
`[ Q op(B) ] [ 0 op(R22) ]`
where A, B, G, Q, R12 are real N-by-N matrices, op(R11) is a real
N-by-N upper triangular matrix, op(R22) is a real N-by-N lower
Hessenberg matrix and U, V are 2N-by-2N orthogonal symplectic
matrices. Blocked version.
See the SLICOT documentation for details.
"""
function mb04tb! end
"""
Compute a symplectic URV (SURV) decomposition of a real
2N-by-2N matrix H:
`[ op(A) G ] T [ op(R11) R12 ] T`
`H = [ ] = U R V = U * [ ] * V ,`
`[ Q op(B) ] [ 0 op(R22) ]`
where A, B, G, Q, R12 are real N-by-N matrices, op(R11) is a real
N-by-N upper triangular matrix, op(R22) is a real N-by-N lower
Hessenberg matrix and U, V are 2N-by-2N orthogonal symplectic
matrices. Unblocked version.
See the SLICOT documentation for details.
"""
function mb04ts! end
"""
Let A and E be M-by-N matrices with E in column echelon form.
Let AA and EE be the following submatrices of A and E:
`AA := A(IFIRA : M ; IFICA : N)`
`EE := E(IFIRA : M ; IFICA : N).`
Let Aj and Ej be the following submatrices of AA and EE:
`Aj := A(IFIRA : M ; IFICA : IFICA + NCA - 1) and`
`Ej := E(IFIRA : M ; IFICA + NCA : N).`
Transform (AA,EE) such that Aj is row compressed while keeping
matrix Ej in column echelon form (which may be different from the
form on entry).
In fact the routine performs the j-th step of Algorithm 3.2.1 in
[1]. Furthermore, it determines the rank RANK of the submatrix Ej,
which is equal to the number of corner points in submatrix Ej.
See the SLICOT documentation for details.
"""
function mb04tt! end
"""
Perform the Givens transformation, defined by C (cos) and S
(sin), and interchange the vectors involved, i.e.
`|X(i)| | 0 1 | | C S | |X(i)|`
`| | := | | x | | x | |, i = 1,...N.`
`|Y(i)| | 1 0 | |-S C | |Y(i)|`
REMARK. This routine is a modification of DROT from BLAS.
`This routine is called only by the SLICOT routines MB04TX`
`and MB04VX.`
NUMERICAL ASPECTS
The algorithm is backward stable.
See the SLICOT documentation for details.
"""
function mb04tu! end
"""
Reduce a submatrix A(k) of A to upper triangular form by column
Givens rotations only.
Here A(k) = A(IFIRA:ma,IFICA:na) where ma = IFIRA - 1 + NRA,
na = IFICA - 1 + NCA.
Matrix A(k) is assumed to have full row rank on entry. Hence, no
pivoting is done during the reduction process. See Algorithm 2.3.1
and Remark 2.3.4 in [1].
The constructed column transformations are also applied to matrix
E(k) = E(1:IFIRA-1,IFICA:na).
Note that in E columns are transformed with the same column
indices as in A, but with row indices different from those in A.
See the SLICOT documentation for details.
"""
function mb04tv! end
"""
Reduce a submatrix E(k) of E to upper triangular form by row
Givens rotations only.
Here E(k) = E(IFIRE:me,IFICE:ne), where me = IFIRE - 1 + NRE,
`ne = IFICE - 1 + NCE.`
Matrix E(k) is assumed to have full column rank on entry. Hence,
no pivoting is done during the reduction process. See Algorithm
2.3.1 and Remark 2.3.4 in [1].
The constructed row transformations are also applied to matrix
A(k) = A(IFIRE:me,IFICA:N).
Note that in A(k) rows are transformed with the same row indices
as in E but with column indices different from those in E.
See the SLICOT documentation for details.
"""
function mb04tw! end
"""
Separate the pencils s*E(eps)-A(eps) and s*E(inf)-A(inf) in
s*E(eps,inf)-A(eps,inf) using Algorithm 3.3.3 in [1].
On entry, it is assumed that the M-by-N matrices A and E have
been obtained after applying the Algorithms 3.2.1 and 3.3.1 to
the pencil s*E - A as described in [1], i.e.
`| s*E(eps,inf)-A(eps,inf) | X |`
`Q'(s*E - A)Z = |-------------------------|-------------|`
`| 0 | s*E(r)-A(r) |`
Here the pencil s*E(eps,inf)-A(eps,inf) is in staircase form.
This pencil contains all Kronecker column indices and infinite
elementary divisors of the pencil s*E - A.
The pencil s*E(r)-A(r) contains all Kronecker row indices and
finite elementary divisors of s*E - A.
Furthermore, the submatrices having full row and column rank in
the pencil s*E(eps,inf)-A(eps,inf) are assumed to be
triangularized.
On exit, the result then is
`Q'(s*E - A)Z =`
`| s*E(eps)-A(eps) | X | X |`
`|-----------------|-----------------|-------------|`
`| 0 | s*E(inf)-A(inf) | X |`
`|===================================|=============|`
`| | |`
`| 0 | s*E(r)-A(r) |`
Note that the pencil s*E(r)-A(r) is not reduced further.
See the SLICOT documentation for details.
"""
function mb04tx! end
"""
Perform the triangularization of the submatrices having full
row and column rank in the pencil s*E(eps,inf)-A(eps,inf) below
`| s*E(eps,inf)-A(eps,inf) | X |`
`s*E - A = |-------------------------|-------------| ,`
`| 0 | s*E(r)-A(r) |`
using Algorithm 3.3.1 in [1].
On entry, it is assumed that the M-by-N matrices A and E have
been transformed to generalized Schur form by unitary
transformations (see Algorithm 3.2.1 in [1]), and that the pencil
s*E(eps,inf)-A(eps,inf) is in staircase form.
This pencil contains all Kronecker column indices and infinite
elementary divisors of the pencil s*E - A.
The pencil s*E(r)-A(r) contains all Kronecker row indices and
finite elementary divisors of s*E - A.
See the SLICOT documentation for details.
"""
function mb04ty! end
"""
Compute orthogonal transformations Q and Z such that the
transformed pencil Q'(sE-A)Z has the E matrix in column echelon
form, where E and A are M-by-N matrices.
See the SLICOT documentation for details.
"""
function mb04ud! end
"""
Compute orthogonal transformations Q and Z such that the
transformed pencil Q'(sE-A)Z is in upper block triangular form,
where E is an M-by-N matrix in column echelon form (see SLICOT
Library routine MB04UD) and A is an M-by-N matrix.
If MODE = 'B', then the matrices A and E are transformed into the
following generalized Schur form by unitary transformations Q1
and Z1 :
`| sE(eps,inf)-A(eps,inf) | X |`
`Q1'(sE-A)Z1 = |------------------------|------------|. (1)`
`| O | sE(r)-A(r) |`
The pencil sE(eps,inf)-A(eps,inf) is in staircase form, and it
contains all Kronecker column indices and infinite elementary
divisors of the pencil sE-A. The pencil sE(r)-A(r) contains all
Kronecker row indices and elementary divisors of sE-A.
Note: X is a pencil.
If MODE = 'T', then the submatrices having full row and column
rank in the pencil sE(eps,inf)-A(eps,inf) in (1) are
triangularized by applying unitary transformations Q2 and Z2 to
Q1'*(sE-A)*Z1.
If MODE = 'S', then the pencil sE(eps,inf)-A(eps,inf) in (1) is
separated into sE(eps)-A(eps) and sE(inf)-A(inf) by applying
unitary transformations Q3 and Z3 to Q2'*Q1'*(sE-A)*Z1*Z2.
This gives
`| sE(eps)-A(eps) | X | X |`
`|----------------|----------------|------------|`
`| O | sE(inf)-A(inf) | X |`
Q'(sE-A)Z =|=================================|============| (2)
`| | |`
`| O | sE(r)-A(r) |`
where Q = Q1*Q2*Q3 and Z = Z1*Z2*Z3.
Note: the pencil sE(r)-A(r) is not reduced further.
See the SLICOT documentation for details.
"""
function mb04vd! end
"""
Separate the pencils s*E(eps)-A(eps) and s*E(inf)-A(inf) in
s*E(eps,inf)-A(eps,inf) using Algorithm 3.3.3 in [1].
On entry, it is assumed that the M-by-N matrices A and E have
been obtained after applying the Algorithms 3.2.1 and 3.3.1 to
the pencil s*E - A as described in [1], i.e.
`| s*E(eps,inf)-A(eps,inf) | X |`
`Q'(s*E - A)Z = |-------------------------|-------------|`
`| 0 | s*E(r)-A(r) |`
Here the pencil s*E(eps,inf)-A(eps,inf) is in staircase form.
This pencil contains all Kronecker column indices and infinite
elementary divisors of the pencil s*E - A.
The pencil s*E(r)-A(r) contains all Kronecker row indices and
finite elementary divisors of s*E - A.
Furthermore, the submatrices having full row and column rank in
the pencil s*E(eps,inf)-A(eps,inf) are assumed to be
triangularized.
On exit, the result then is
`Q'(s*E - A)Z =`
`| s*E(eps)-A(eps) | X | X |`
`|-----------------|-----------------|-------------|`
`| 0 | s*E(inf)-A(inf) | X |`
`|===================================|=============|`
`| | |`
`| 0 | s*E(r)-A(r) |`
Note that the pencil s*E(r)-A(r) is not reduced further.
See the SLICOT documentation for details.
"""
function mb04vx! end
"""
Generate a matrix Q with orthogonal columns (spanning an
isotropic subspace), which is defined as the first n columns
of a product of symplectic reflectors and Givens rotations,
`Q = diag( H(1),H(1) ) G(1) diag( F(1),F(1) )`
`diag( H(2),H(2) ) G(2) diag( F(2),F(2) )`
`....`
`diag( H(k),H(k) ) G(k) diag( F(k),F(k) ).`
The matrix Q is returned in terms of its first 2*M rows
`[ op( Q1 ) op( Q2 ) ]`
`Q = [ ].`
`[ -op( Q2 ) op( Q1 ) ]`
Blocked version of the SLICOT Library routine MB04WU.
See the SLICOT documentation for details.
"""
function mb04wd! end
"""
Generate an orthogonal symplectic matrix U, which is defined as
a product of symplectic reflectors and Givens rotations
U = diag( H(1),H(1) ) G(1) diag( F(1),F(1) )
`diag( H(2),H(2) ) G(2) diag( F(2),F(2) )`
`....`
`diag( H(n-1),H(n-1) ) G(n-1) diag( F(n-1),F(n-1) ).`
as returned by MB04PU. The matrix U is returned in terms of its
first N rows
`[ U1 U2 ]`
`U = [ ].`
`[ -U2 U1 ]`
See the SLICOT documentation for details.
"""
function mb04wp! end
"""
Generate orthogonal symplectic matrices U or V, defined as
products of symplectic reflectors and Givens rotations
U = diag( HU(1),HU(1) ) GU(1) diag( FU(1),FU(1) )
`diag( HU(2),HU(2) ) GU(2) diag( FU(2),FU(2) )`
`....`
`diag( HU(n),HU(n) ) GU(n) diag( FU(n),FU(n) ),`
V = diag( HV(1),HV(1) ) GV(1) diag( FV(1),FV(1) )
`diag( HV(2),HV(2) ) GV(2) diag( FV(2),FV(2) )`
`....`
`diag( HV(n-1),HV(n-1) ) GV(n-1) diag( FV(n-1),FV(n-1) ),`
as returned by the SLICOT Library routines MB04TS or MB04TB. The
matrices U and V are returned in terms of their first N/2 rows:
`[ U1 U2 ] [ V1 V2 ]`
`U = [ ], V = [ ].`
`[ -U2 U1 ] [ -V2 V1 ]`
See the SLICOT documentation for details.
"""
function mb04wr! end
"""
Generate a matrix Q with orthogonal columns (spanning an
isotropic subspace), which is defined as the first n columns
of a product of symplectic reflectors and Givens rotations,
`Q = diag( H(1),H(1) ) G(1) diag( F(1),F(1) )`
`diag( H(2),H(2) ) G(2) diag( F(2),F(2) )`
`....`
`diag( H(k),H(k) ) G(k) diag( F(k),F(k) ).`
The matrix Q is returned in terms of its first 2*M rows
`[ op( Q1 ) op( Q2 ) ]`
`Q = [ ].`
`[ -op( Q2 ) op( Q1 ) ]`
See the SLICOT documentation for details.
"""
function mb04wu! end
"""
Compute a basis for the left and/or right singular subspace of
an M-by-N matrix A corresponding to its smallest singular values.
See the SLICOT documentation for details.
"""
function mb04xd! end
"""
Apply the Householder transformations Pj stored in factored
form into the columns of the array X, to the desired columns of
the matrix U by premultiplication, and/or the Householder
transformations Qj stored in factored form into the rows of the
array X, to the desired columns of the matrix V by
premultiplication. The Householder transformations Pj and Qj
are stored as produced by LAPACK Library routine DGEBRD.
See the SLICOT documentation for details.
"""
function mb04xy! end
"""
Partially diagonalize the bidiagonal matrix
`|q(1) e(1) 0 ... 0 |`
`| 0 q(2) e(2) . |`
`J = | . . | (1)`
`| . e(MIN(M,N)-1)|`
`| 0 ... ... q(MIN(M,N)) |`
using QR or QL iterations in such a way that J is split into
unreduced bidiagonal submatrices whose singular values are either
all larger than a given bound or are all smaller than (or equal
to) this bound. The left- and right-hand Givens rotations
performed on J (corresponding to each QR or QL iteration step) may
be optionally accumulated in the arrays U and V.
See the SLICOT documentation for details.
"""
function mb04yd! end
"""
Perform either one QR or QL iteration step onto the unreduced
bidiagonal submatrix Jk:
`|D(l) E(l) 0 ... 0 |`
`| 0 D(l+1) E(l+1) . |`
`Jk = | . . |`
`| . . |`
`| . E(k-1)|`
`| 0 ... ... D(k) |`
with k <= p and l >= 1, p = MIN(M,N), of the bidiagonal matrix J:
`|D(1) E(1) 0 ... 0 |`
`| 0 D(2) E(2) . |`
`J = | . . |.`
`| . . |`
`| . E(p-1)|`
`| 0 ... ... D(p) |`
Hereby, Jk is transformed to S' Jk T with S and T products of
Givens rotations. These Givens rotations S (respectively, T) are
postmultiplied into U (respectively, V), if UPDATU (respectively,
UPDATV) is .TRUE..
See the SLICOT documentation for details.
"""
function mb04yw! end
"""
Transform a Hamiltonian matrix
`( A G )`
`H = ( T ) (1)`
`( Q -A )`
into a square-reduced Hamiltonian matrix
`( A' G' )`
`H' = ( T ) (2)`
`( Q' -A' )`
`T`
by an orthogonal symplectic similarity transformation H' = U H U,
where
`( U1 U2 )`
`U = ( ). (3)`
`( -U2 U1 )`
`T`
The square-reduced Hamiltonian matrix satisfies Q'A' - A' Q' = 0,
and
`2 T 2 ( A'' G'' )`
`H' := (U H U) = ( T ).`
`( 0 A'' )`
In addition, A'' is upper Hessenberg and G'' is skew symmetric.
The square roots of the eigenvalues of A'' = A'*A' + G'*Q' are the
eigenvalues of H.
See the SLICOT documentation for details.
"""
function mb04zd! end
"""
Compute exp(A*delta) where A is a real N-by-N non-defective
matrix with real or complex eigenvalues and delta is a scalar
value. The routine also returns the eigenvalues and eigenvectors
of A as well as (if all eigenvalues are real) the matrix product
exp(Lambda*delta) times the inverse of the eigenvector matrix
of A, where Lambda is the diagonal matrix of eigenvalues.
Optionally, the routine computes a balancing transformation to
improve the conditioning of the eigenvalues and eigenvectors.
See the SLICOT documentation for details.
"""
function mb05md! end
"""
Compute, for an N-by-N real nonsymmetric matrix A, the
orthogonal matrix Q reducing it to real Schur form T, the
eigenvalues, and the right eigenvectors of T.
The right eigenvector r(j) of T satisfies
`T * r(j) = lambda(j) * r(j)`
where lambda(j) is its eigenvalue.
The matrix of right eigenvectors R is upper triangular, by
construction.
See the SLICOT documentation for details.
"""
function mb05my! end
"""
Compute
(a) F(delta) = exp(A*delta) and
(b) H(delta) = Int[F(s) ds] from s = 0 to s = delta,
where A is a real N-by-N matrix and delta is a scalar value.
See the SLICOT documentation for details.
"""
function mb05nd! end
"""
Compute exp(A*delta) where A is a real N-by-N matrix and delta
is a scalar value. The routine also returns the minimal number of
accurate digits in the 1-norm of exp(A*delta) and the number of
accurate digits in the 1-norm of exp(A*delta) at 95% confidence
level.
See the SLICOT documentation for details.
"""
function mb05od! end
"""
Restore a matrix after it has been transformed by applying
balancing transformations (permutations and scalings), as
determined by LAPACK Library routine DGEBAL.
See the SLICOT documentation for details.
"""
function mb05oy! end
"""
Move the eigenvalues with strictly negative real parts of an
N-by-N complex skew-Hamiltonian/Hamiltonian pencil aS - bH in
structured Schur form to the leading principal subpencil, while
keeping the triangular form. On entry, we have
`( A D ) ( B F )`
`S = ( ), H = ( ),`
`( 0 A' ) ( 0 -B' )`
where A and B are upper triangular.
S and H are transformed by a unitary matrix Q such that
`( Aout Dout )`
`Sout = J Q' J' S Q = ( ), and`
`( 0 Aout' )`
`(1)`
`( Bout Fout ) ( 0 I )`
`Hout = J Q' J' H Q = ( ), with J = ( ),`
`( 0 -Bout' ) ( -I 0 )`
where Aout and Bout remain in upper triangular form. The notation
M' denotes the conjugate transpose of the matrix M.
Optionally, if COMPQ = 'I' or COMPQ = 'U', the unitary matrix Q
that fulfills (1) is computed.
See the SLICOT documentation for details.
"""
function mb3jzp! end
"""
Compute the eigenvalues of a complex N-by-N skew-Hamiltonian/
Hamiltonian pencil aS - bH, with
`( A D ) ( B F )`
`S = ( ) and H = ( ). (1)`
`( E A' ) ( G -B' )`
The structured Schur form of the embedded real skew-Hamiltonian/
skew-Hamiltonian pencil a`B_S` - b`B_T`, defined as
`( Re(A) -Im(A) | Re(D) -Im(D) )`
`( | )`
`( Im(A) Re(A) | Im(D) Re(D) )`
`( | )`
`B_S = (-----------------+-----------------) , and`
`( | )`
`( Re(E) -Im(E) | Re(A') Im(A') )`
`( | )`
`( Im(E) Re(E) | -Im(A') Re(A') )`
`(2)`
`( -Im(B) -Re(B) | -Im(F) -Re(F) )`
`( | )`
`( Re(B) -Im(B) | Re(F) -Im(F) )`
`( | )`
`B_T = (-----------------+-----------------) , T = i*H,`
`( | )`
`( -Im(G) -Re(G) | -Im(B') Re(B') )`
`( | )`
`( Re(G) -Im(G) | -Re(B') -Im(B') )`
is determined and used to compute the eigenvalues. The notation M'
denotes the conjugate transpose of the matrix M. Optionally,
if COMPQ = 'C', an orthonormal basis of the right deflating
subspace of the pencil aS - bH, corresponding to the eigenvalues
with strictly negative real part, is computed. Namely, after
transforming a`B_S` - b`B_H` by unitary matrices, we have
`( BA BD ) ( BB BF )`
`B_Sout = ( ) and B_Hout = ( ), (3)`
`( 0 BA' ) ( 0 -BB' )`
and the eigenvalues with strictly negative real part of the
complex pencil a`B_S`out - b`B_H`out are moved to the top. The
embedding doubles the multiplicities of the eigenvalues of the
pencil aS - bH.
See the SLICOT documentation for details.
"""
function mb3lzp! end
"""
Compute a rank-revealing QR factorization of a complex general
M-by-N matrix A, which may be rank-deficient, and estimate its
effective rank using incremental condition estimation.
The routine uses a truncated QR factorization with column pivoting
`[ R11 R12 ]`
`A * P = Q * R, where R = [ ],`
`[ 0 R22 ]`
with R11 defined as the largest leading upper triangular submatrix
whose estimated condition number is less than 1/RCOND. The order
of R11, RANK, is the effective rank of A. Condition estimation is
performed during the QR factorization process. Matrix R22 is full
(but of small norm), or empty.
MB3OYZ does not perform any scaling of the matrix A.
See the SLICOT documentation for details.
"""
function mb3oyz! end
"""
Compute a rank-revealing RQ factorization of a complex general
M-by-N matrix A, which may be rank-deficient, and estimate its
effective rank using incremental condition estimation.
The routine uses a truncated RQ factorization with row pivoting:
`[ R11 R12 ]`
`P * A = R * Q, where R = [ ],`
`[ 0 R22 ]`
with R22 defined as the largest trailing upper triangular
submatrix whose estimated condition number is less than 1/RCOND.
The order of R22, RANK, is the effective rank of A. Condition
estimation is performed during the RQ factorization process.
Matrix R11 is full (but of small norm), or empty.
MB3PYZ does not perform any scaling of the matrix A.
See the SLICOT documentation for details.
"""
function mb3pyz! end
"""
Apply from the left the inverse of a balancing transformation,
computed by the SLICOT Library routine MB4DPZ, to the complex
matrix
`[ V1 ]`
`[ ],`
`[ sgn*V2 ]`
where sgn is either +1 or -1.
See the SLICOT documentation for details.
"""
function mb4dbz! end
"""
Balance a pair of N-by-N complex matrices (A,B). This involves,
first, permuting A and B by equivalence transformations to isolate
eigenvalues in the first 1 to ILO-1 and last IHI+1 to N elements
on the diagonal of A and B; and second, applying a diagonal
equivalence transformation to rows and columns ILO to IHI to make
the rows and columns as close in 1-norm as possible. Both steps
are optional. Balancing may reduce the 1-norms of the matrices,
and improve the accuracy of the computed eigenvalues and/or
eigenvectors in the generalized eigenvalue problem
A*x = lambda*B*x.
This routine may optionally improve the conditioning of the
scaling transformation compared to the LAPACK routine ZGGBAL.
See the SLICOT documentation for details.
"""
function mb4dlz! end
"""
Balance the 2*N-by-2*N complex skew-Hamiltonian/Hamiltonian
pencil aS - bH, with
`( A D ) ( C V )`
`S = ( ) and H = ( ), A, C N-by-N, (1)`
`( E A' ) ( W -C' )`
where D and E are skew-Hermitian, V and W are Hermitian matrices,
and ' denotes conjugate transpose. This involves, first, permuting
aS - bH by a symplectic equivalence transformation to isolate
eigenvalues in the first 1:ILO-1 elements on the diagonal of A
and C; and second, applying a diagonal equivalence transformation
to make the pairs of rows and columns ILO:N and N+ILO:2*N as close
in 1-norm as possible. Both steps are optional. Balancing may
reduce the 1-norms of the matrices S and H.
See the SLICOT documentation for details.
"""
function mb4dpz! end
"""
Calculate, for a given real polynomial P(x) and a real scalar
alpha, the leading K coefficients of the shifted polynomial
`K-1`
`P(x) = q(1) + q(2) * (x-alpha) + ... + q(K) * (x-alpha) + ...`
using Horner's algorithm.
See the SLICOT documentation for details.
"""
function mc01md! end
"""
Compute the value of the real polynomial P(x) at a given
complex point x = x0 using Horner's algorithm.
See the SLICOT documentation for details.
"""
function mc01nd! end
"""
Compute the coefficients of a complex polynomial P(x) from its
zeros.
See the SLICOT documentation for details.
"""
function mc01od! end
"""
Compute the coefficients of a real polynomial P(x) from its
zeros.
See the SLICOT documentation for details.
"""
function mc01pd! end
"""
Compute the coefficients of a real polynomial P(x) from its
zeros. The coefficients are stored in decreasing order of the
powers of x.
See the SLICOT documentation for details.
"""
function mc01py! end
"""
Compute, for two given real polynomials A(x) and B(x), the
quotient polynomial Q(x) and the remainder polynomial R(x) of
A(x) divided by B(x).
The polynomials Q(x) and R(x) satisfy the relationship
`A(x) = B(x) * Q(x) + R(x),`
where the degree of R(x) is less than the degree of B(x).
See the SLICOT documentation for details.
"""
function mc01qd! end
"""
Compute the coefficients of the polynomial
`P(x) = P1(x) * P2(x) + alpha * P3(x),`
where P1(x), P2(x) and P3(x) are given real polynomials and alpha
is a real scalar.
Each of the polynomials P1(x), P2(x) and P3(x) may be the zero
polynomial.
See the SLICOT documentation for details.
"""
function mc01rd! end
"""
Scale the coefficients of the real polynomial P(x) such that
the coefficients of the scaled polynomial Q(x) = sP(tx) have
minimal variation, where s and t are real scalars.
See the SLICOT documentation for details.
"""
function mc01sd! end
"""
Find the mantissa M and the exponent E of a real number A such
that
`A = M * B**E`
`1 <= ABS( M ) < B`
if A is non-zero. If A is zero, then M and E are set to 0.
See the SLICOT documentation for details.
"""
function mc01sw! end
"""
Compute the variation V of the exponents of a series of
non-zero floating-point numbers: a(j) = MANT(j) * beta**(E(j)),
where beta is the base of the machine representation of
floating-point numbers, i.e.,
V = max(E(j)) - min(E(j)), j = LB,...,UB and MANT(j) non-zero.
See the SLICOT documentation for details.
"""
function mc01sx! end
"""
Find a real number A from its mantissa M and its exponent E,
i.e.,
`A = M * B**E.`
M and E need not be the standard floating-point values.
If ABS(A) < B**(EMIN-1), i.e. the smallest positive model number,
then the routine returns A = 0.
If M = 0, then the routine returns A = 0 regardless of the value
of E.
See the SLICOT documentation for details.
"""
function mc01sy! end
"""
Determine whether or not a given polynomial P(x) with real
coefficients is stable, either in the continuous-time or discrete-
time case.
A polynomial is said to be stable in the continuous-time case
if all its zeros lie in the left half-plane, and stable in the
discrete-time case if all its zeros lie inside the unit circle.
See the SLICOT documentation for details.
"""
function mc01td! end
"""
Compute the roots of a quadratic equation with real
coefficients.
See the SLICOT documentation for details.
"""
function mc01vd! end
"""
Compute, for a given real polynomial P(x) and a quadratic
polynomial B(x), the quotient polynomial Q(x) and the linear
remainder polynomial R(x) such that
`P(x) = B(x) * Q(x) + R(x),`
`2`
where B(x) = u1 + u2 * x + x , R(x) = q(1) + q(2) * (u2 + x)
and u1, u2, q(1) and q(2) are real scalars.
See the SLICOT documentation for details.
"""
function mc01wd! end
"""
Compute the roots of the polynomial
`P(t) = ALPHA + BETA*t + GAMMA*t^2 + DELTA*t^3 .`
See the SLICOT documentation for details.
"""
function mc01xd! end
"""
Compute the coefficients of the real polynomial matrix
`P(x) = P1(x) * P2(x) + alpha * P3(x),`
where P1(x), P2(x) and P3(x) are given real polynomial matrices
and alpha is a real scalar.
Each of the polynomial matrices P1(x), P2(x) and P3(x) may be the
zero matrix.
See the SLICOT documentation for details.
"""
function mc03md! end
"""
Compute the coefficients of a minimal polynomial basis
`DK`
`K(s) = K(0) + K(1) * s + ... + K(DK) * s`
for the right nullspace of the MP-by-NP polynomial matrix of
degree DP, given by
`DP`
`P(s) = P(0) + P(1) * s + ... + P(DP) * s ,`
which corresponds to solving the polynomial matrix equation
P(s) * K(s) = 0.
See the SLICOT documentation for details.
"""
function mc03nd! end
"""
Given an MP-by-NP polynomial matrix of degree dp
`dp-1 dp`
P(s) = P(0) + ... + P(dp-1) * s + P(dp) * s (1)
the routine composes the related pencil s*E-A where
`| I | | O -P(dp) |`
`| . | | I . . |`
A = | . | and E = | . . . |. (2)
`| . | | . O . |`
`| I | | I O -P(2) |`
`| P(0) | | I -P(1) |`
==================================================================
REMARK: This routine is intended to be called only from the SLICOT
`routine MC03ND.`
==================================================================
See the SLICOT documentation for details.
"""
function mc03nx! end
"""
Determine a minimal basis of the right nullspace of the
subpencil s*E(eps)-A(eps) using the method given in [1] (see
Eqs.(4.6.8), (4.6.9)).
This pencil only contains Kronecker column indices, and it must be
in staircase form as supplied by SLICOT Library Routine MB04VD.
The basis vectors are represented by matrix V(s) having the form
`| V11(s) V12(s) V13(s) . . V1n(s) |`
`| V22(s) V23(s) V2n(s) |`
`| V33(s) . |`
`V(s) = | . . |`
`| . . |`
`| . . |`
`| Vnn(s) |`
where n is the number of full row rank blocks in matrix A(eps) and
`k j-i`
`Vij(s) = Vij,0 + Vij,1*s +...+ Vij,k*s +...+ Vij,j-i*s . (1)`
In other words, Vij,k is the coefficient corresponding to degree k
in the matrix polynomial Vij(s).
Vij,k has dimensions mu(i)-by-(mu(j)-nu(j)).
The coefficients Vij,k are stored in the matrix VEPS as follows
(for the case n = 3):
`sizes m1-n1 m2-n2 m2-n2 m3-n3 m3-n3 m3-n3`
`m1 { | V11,0 || V12,0 | V12,1 || V13,0 | V13,1 | V13,2 ||`
`| || | || | | ||`
`VEPS = m2 { | || V22,0 | || V23,0 | V23,1 | ||`
`| || | || | | ||`
`m3 { | || | || V33,0 | | ||`
where mi = mu(i), ni = nu(i).
Matrix VEPS has dimensions nrv-by-ncv where
`nrv = Sum(i=1,...,n) mu(i)`
`ncv = Sum(i=1,...,n) i*(mu(i)-nu(i))`
==================================================================
REMARK: This routine is intended to be called only from the SLICOT
`routine MC03ND.`
==================================================================
See the SLICOT documentation for details.
"""
function mc03ny! end
"""
Compute the QR factorization with column pivoting of an
m-by-n Jacobian matrix J (m >= n), that is, J*P = Q*R, where Q is
a matrix with orthogonal columns, P a permutation matrix, and
R an upper trapezoidal matrix with diagonal elements of
nonincreasing magnitude, and to apply the transformation Q' on
the error vector e (in-situ). The 1-norm of the scaled gradient
is also returned.
This routine is an interface to SLICOT Library routine MD03BX,
for solving standard nonlinear least squares problems using SLICOT
routine MD03BD.
See the SLICOT documentation for details.
"""
function md03ba! end
"""
Determine a value for the parameter PAR such that if x solves
the system
`A*x = b , sqrt(PAR)*D*x = 0 ,`
in the least squares sense, where A is an m-by-n matrix, D is an
n-by-n nonsingular diagonal matrix, and b is an m-vector, and if
DELTA is a positive number, DXNORM is the Euclidean norm of D*x,
then either PAR is zero and
`( DXNORM - DELTA ) .LE. 0.1*DELTA ,`
or PAR is positive and
`ABS( DXNORM - DELTA ) .LE. 0.1*DELTA .`
It is assumed that a QR factorization, with column pivoting, of A
is available, that is, A*P = Q*R, where P is a permutation matrix,
Q has orthogonal columns, and R is an upper triangular matrix
with diagonal elements of nonincreasing magnitude.
The routine needs the full upper triangle of R, the permutation
matrix P, and the first n components of Q'*b (' denotes the
transpose). On output, MD03BB also provides an upper triangular
matrix S such that
`P'*(A'*A + PAR*D*D)*P = S'*S .`
Matrix S is used in the solution process.
This routine is an interface to SLICOT Library routine MD03BY,
for solving standard nonlinear least squares problems using SLICOT
routine MD03BD.
See the SLICOT documentation for details.
"""
function md03bb! end
"""
This is the FCN routine for solving a standard nonlinear least
squares problem using SLICOT Library routine MD03BD. See the
parameter FCN in the routine MD03BD for the description of
parameters.
The example programmed in this routine is adapted from that
accompanying the MINPACK routine LMDER.
******************************************************************
See the SLICOT documentation for details.
"""
function md03bf! end
"""
Compute the QR factorization with column pivoting of an
m-by-n matrix J (m >= n), that is, J*P = Q*R, where Q is a matrix
with orthogonal columns, P a permutation matrix, and R an upper
trapezoidal matrix with diagonal elements of nonincreasing
magnitude, and to apply the transformation Q' on the error
vector e (in-situ). The 1-norm of the scaled gradient is also
returned. The matrix J could be the Jacobian of a nonlinear least
squares problem.
See the SLICOT documentation for details.
"""
function md03bx! end
"""
Determine a value for the parameter PAR such that if x solves
the system
`A*x = b , sqrt(PAR)*D*x = 0 ,`
in the least squares sense, where A is an m-by-n matrix, D is an
n-by-n nonsingular diagonal matrix, and b is an m-vector, and if
DELTA is a positive number, DXNORM is the Euclidean norm of D*x,
then either PAR is zero and
`( DXNORM - DELTA ) .LE. 0.1*DELTA ,`
or PAR is positive and
`ABS( DXNORM - DELTA ) .LE. 0.1*DELTA .`
It is assumed that a QR factorization, with column pivoting, of A
is available, that is, A*P = Q*R, where P is a permutation matrix,
Q has orthogonal columns, and R is an upper triangular matrix
with diagonal elements of nonincreasing magnitude.
The routine needs the full upper triangle of R, the permutation
matrix P, and the first n components of Q'*b (' denotes the
transpose). On output, MD03BY also provides an upper triangular
matrix S such that
`P'*(A'*A + PAR*D*D)*P = S'*S .`
Matrix S is used in the solution process.
See the SLICOT documentation for details.
"""
function md03by! end
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 229854 | const BlasBool = BlasInt
# automatically built wrappers for SLICOT
"""
$(TYPEDSIGNATURES)
returns (yr, yi)
"""
function ma01ad!(xr::Number, xi::Number)
yr = Ref{Float64}()
yi = Ref{Float64}()
ccall((:ma01ad_, libslicot), Cvoid, (Ref{Float64}, Ref{Float64},
Ptr{Float64}, Ptr{Float64}), xr, xi, yr, yi)
return yr[], yi[]
end
"""
$(TYPEDSIGNATURES)
returns (alpha, beta, scal)
"""
function ma01bd!(base::Number, lgbas::Number, k::Integer,
s::AbstractVector{BlasInt}, a::AbstractVector{Float64},
inca::Integer)
alpha = Ref{Float64}()
beta = Ref{Float64}()
scal = Ref{BlasInt}()
ccall((:ma01bd_, libslicot), Cvoid, (Ref{Float64}, Ref{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}), base, lgbas,
k, s, a, inca, alpha, beta, scal)
return alpha[], beta[], scal[]
end
"""
$(TYPEDSIGNATURES)
returns (alpha, beta, scal)
"""
function ma01bz!(base::Number, k::Integer, s::AbstractVector{BlasInt},
a::AbstractVector{ComplexF64}, inca::Integer)
alpha = Ref{ComplexF64}()
beta = Ref{ComplexF64}()
scal = Ref{BlasInt}()
ccall((:ma01bz_, libslicot), Cvoid, (Ref{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ptr{ComplexF64}, Ptr{BlasInt}), base,
k, s, a, inca, alpha, beta, scal)
return alpha[], beta[], scal[]
end
"""
$(TYPEDSIGNATURES)
"""
function ma01cd!(a::Number, ia::Integer, b::Number, ib::Integer)
jlres = ccall((:ma01cd_, libslicot), BlasInt, (Ref{Float64},
Ref{BlasInt}, Ref{Float64}, Ref{BlasInt}), a, ia, b, ib)
return jlres
end
"""
$(TYPEDSIGNATURES)
"""
function ma02ad!(job::AbstractChar, m::Integer, n::Integer,
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ccall((:ma02ad_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Clong), job, m, n, a, lda, b, ldb, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function ma02bd!(side::AbstractChar, m::Integer, n::Integer,
a::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ccall((:ma02bd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Clong), side,
m, n, a, lda, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function ma02bz!(side::AbstractChar, m::Integer, n::Integer,
a::AbstractMatrix{ComplexF64})
lda = max(1,stride(a,2))
ccall((:ma02bz_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt}, Clong),
side, m, n, a, lda, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function ma02cd!(n::Integer, kl::Integer, ku::Integer,
a::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ccall((:ma02cd_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}), n, kl, ku, a,
lda)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function ma02cz!(n::Integer, kl::Integer, ku::Integer,
a::AbstractMatrix{ComplexF64})
lda = max(1,stride(a,2))
ccall((:ma02cz_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt}), n, kl, ku,
a, lda)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function ma02dd!(job::AbstractChar, uplo::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, ap::AbstractVector{Float64})
lda = max(1,stride(a,2))
ccall((:ma02dd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Clong, Clong), job, uplo, n, a, lda, ap, 1, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function ma02ed!(uplo::AbstractChar, n::Integer,
a::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ccall((:ma02ed_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Clong), uplo, n, a, lda, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function ma02es!(uplo::AbstractChar, n::Integer,
a::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ccall((:ma02es_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Clong), uplo, n, a, lda, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function ma02ez!(uplo::AbstractChar, trans::AbstractChar,
skew::AbstractChar, n::Integer, a::AbstractMatrix{ComplexF64})
lda = max(1,stride(a,2))
ccall((:ma02ez_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Clong, Clong, Clong), uplo, trans, skew, n, a, lda, 1,
1, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns (x1, c, s, info)
"""
function ma02fd!(ini_x1::Number, x2::Number)
x1 = Ref{Float64}(ini_x1)
c = Ref{Float64}()
s = Ref{Float64}()
info = Ref{BlasInt}()
ccall((:ma02fd_, libslicot), Cvoid, (Ptr{Float64}, Ref{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}), x1, x2, c, s,
info)
chkargsok(info[])
return x1[], c[], s[], info[]
end
"""
$(TYPEDSIGNATURES)
"""
function ma02gd!(n::Integer, a::AbstractMatrix{Float64}, k1::Integer,
k2::Integer, ipiv::AbstractVector{BlasInt}, incx::Integer)
lda = max(1,stride(a,2))
ccall((:ma02gd_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{BlasInt},
Ref{BlasInt}), n, a, lda, k1, k2, ipiv, incx)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function ma02gz!(n::Integer, a::AbstractMatrix{ComplexF64},
k1::Integer, k2::Integer, ipiv::AbstractVector{BlasInt},
incx::Integer)
lda = max(1,stride(a,2))
ccall((:ma02gz_, libslicot), Cvoid, (Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{BlasInt}, Ref{BlasInt}), n, a, lda,
k1, k2, ipiv, incx)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function ma02hd!(job::AbstractChar, m::Integer, n::Integer,
diag::Number, a::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
jlres = ccall((:ma02hd_, libslicot), BlasBool, (Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Clong), job, m, n, diag, a, lda, 1)
return jlres
end
"""
$(TYPEDSIGNATURES)
"""
function ma02hz!(job::AbstractChar, m::Integer, n::Integer,
diag::Complex, a::AbstractMatrix{ComplexF64})
lda = max(1,stride(a,2))
jlres = ccall((:ma02hz_, libslicot), BlasBool, (Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{ComplexF64},
Ptr{ComplexF64}, Ref{BlasInt}, Clong), job, m, n, diag,
a, lda, 1)
return jlres
end
"""
$(TYPEDSIGNATURES)
"""
function ma02id!(typ::AbstractChar, norm::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, qg::AbstractMatrix{Float64},
dwork::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
jlres = ccall((:ma02id_, libslicot), Float64, (Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Clong, Clong),
typ, norm, n, a, lda, qg, ldqg, dwork, 1, 1)
return jlres
end
"""
$(TYPEDSIGNATURES)
"""
function ma02iz!(typ::AbstractChar, norm::AbstractChar, n::Integer,
a::AbstractMatrix{ComplexF64}, qg::AbstractMatrix{ComplexF64},
dwork::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
jlres = ccall((:ma02iz_, libslicot), Float64, (Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{Float64}, Clong,
Clong), typ, norm, n, a, lda, qg, ldqg, dwork, 1, 1)
return jlres
end
"""
$(TYPEDSIGNATURES)
"""
function ma02jd!(ltran1::Bool, ltran2::Bool, n::Integer,
q1::AbstractMatrix{Float64}, q2::AbstractMatrix{Float64})
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
ldres = max(1,n)
res = Matrix{Float64}(undef, ldres,n)
jlres = ccall((:ma02jd_, libslicot), Float64, (Ref{BlasBool},
Ref{BlasBool}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}),
ltran1, ltran2, n, q1, ldq1, q2, ldq2, res, ldres)
return jlres
end
"""
$(TYPEDSIGNATURES)
"""
function ma02jz!(ltran1::Bool, ltran2::Bool, n::Integer,
q1::AbstractMatrix{ComplexF64}, q2::AbstractMatrix{ComplexF64})
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
ldres = max(1,n)
res = Matrix{ComplexF64}(undef, ldres,n)
jlres = ccall((:ma02jz_, libslicot), Float64, (Ref{BlasBool},
Ref{BlasBool}, Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}), ltran1, ltran2, n, q1, ldq1, q2, ldq2,
res, ldres)
return jlres
end
"""
$(TYPEDSIGNATURES)
"""
function ma02md!(norm::AbstractChar, uplo::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, dwork::AbstractVector{Float64})
lda = max(1,stride(a,2))
jlres = ccall((:ma02md_, libslicot), Float64, (Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Clong, Clong), norm, uplo, n, a, lda,
dwork, 1, 1)
return jlres
end
"""
$(TYPEDSIGNATURES)
"""
function ma02mz!(norm::AbstractChar, uplo::AbstractChar, n::Integer,
a::AbstractMatrix{ComplexF64}, dwork::AbstractVector{Float64})
lda = max(1,stride(a,2))
jlres = ccall((:ma02mz_, libslicot), Float64, (Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{Float64}, Clong, Clong), norm, uplo, n, a, lda,
dwork, 1, 1)
return jlres
end
"""
$(TYPEDSIGNATURES)
"""
function ma02nz!(uplo::AbstractChar, trans::AbstractChar,
skew::AbstractChar, n::Integer, k::Integer, l::Integer,
a::AbstractMatrix{ComplexF64})
lda = max(1,stride(a,2))
ccall((:ma02nz_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Clong, Clong, Clong),
uplo, trans, skew, n, k, l, a, lda, 1, 1, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function ma02od!(skew::AbstractChar, m::Integer,
a::AbstractMatrix{Float64}, de::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
jlres = ccall((:ma02od_, libslicot), BlasInt, (Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Clong), skew, m, a, lda, de, ldde, 1)
return jlres
end
"""
$(TYPEDSIGNATURES)
"""
function ma02oz!(skew::AbstractChar, m::Integer,
a::AbstractMatrix{ComplexF64}, de::AbstractMatrix{ComplexF64})
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
jlres = ccall((:ma02oz_, libslicot), BlasInt, (Ref{UInt8},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Clong), skew, m, a, lda,
de, ldde, 1)
return jlres
end
"""
$(TYPEDSIGNATURES)
returns (nzr, nzc)
"""
function ma02pd!(m::Integer, n::Integer, a::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
nzr = Ref{BlasInt}()
nzc = Ref{BlasInt}()
ccall((:ma02pd_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}),
m, n, a, lda, nzr, nzc)
return nzr[], nzc[]
end
"""
$(TYPEDSIGNATURES)
returns (nzr, nzc)
"""
function ma02pz!(m::Integer, n::Integer,
a::AbstractMatrix{ComplexF64})
lda = max(1,stride(a,2))
nzr = Ref{BlasInt}()
nzc = Ref{BlasInt}()
ccall((:ma02pz_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}), m, n, a, lda, nzr, nzc)
return nzr[], nzc[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01kd!(uplo::AbstractChar, trans::AbstractChar, n::Integer,
k::Integer, alpha::Number, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, beta::Number,
c::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldc = max(1,stride(c,2))
info = Ref{BlasInt}()
ccall((:mb01kd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ref{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong),
uplo, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc,
info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01ld!(uplo::AbstractChar, trans::AbstractChar, m::Integer,
n::Integer, alpha::Number, beta::Number,
r::AbstractMatrix{Float64}, a::AbstractMatrix{Float64},
x::AbstractMatrix{Float64}, ldwork::Integer)
ldr = max(1,stride(r,2))
lda = max(1,stride(a,2))
ldx = max(1,stride(x,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb01ld_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{Float64}, Ref{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong, Clong), uplo, trans, m, n, alpha,
beta, r, ldr, a, lda, x, ldx, dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01md!(uplo::AbstractChar, n::Integer, alpha::Number,
a::AbstractMatrix{Float64}, x::AbstractVector{Float64},
incx::Integer, beta::Number, y::AbstractVector{Float64},
incy::Integer)
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
ccall((:mb01md_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Clong), uplo, n, alpha, a, lda, x, incx, beta, y, incy,
1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01nd!(uplo::AbstractChar, n::Integer, alpha::Number,
x::AbstractVector{Float64}, incx::Integer,
y::AbstractVector{Float64}, incy::Integer,
a::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
ccall((:mb01nd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Clong), uplo,
n, alpha, x, incx, y, incy, a, lda, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01oc!(uplo::AbstractChar, trans::AbstractChar, n::Integer,
alpha::Number, beta::Number, r::AbstractMatrix{Float64},
h::AbstractMatrix{Float64}, x::AbstractMatrix{Float64})
ldr = max(1,stride(r,2))
ldh = max(1,stride(h,2))
ldx = max(1,stride(x,2))
info = Ref{BlasInt}()
ccall((:mb01oc_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{Float64}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), uplo, trans,
n, alpha, beta, r, ldr, h, ldh, x, ldx, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01od!(uplo::AbstractChar, trans::AbstractChar, n::Integer,
alpha::Number, beta::Number, r::AbstractMatrix{Float64},
h::AbstractMatrix{Float64}, x::AbstractMatrix{Float64},
e::AbstractMatrix{Float64}, ldwork::Integer)
ldr = max(1,stride(r,2))
ldh = max(1,stride(h,2))
ldx = max(1,stride(x,2))
lde = max(1,stride(e,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb01od_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{Float64}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), uplo, trans,
n, alpha, beta, r, ldr, h, ldh, x, ldx, e, lde, dwork,
ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01oe!(uplo::AbstractChar, trans::AbstractChar, n::Integer,
alpha::Number, beta::Number, r::AbstractMatrix{Float64},
h::AbstractMatrix{Float64}, e::AbstractMatrix{Float64})
ldr = max(1,stride(r,2))
ldh = max(1,stride(h,2))
lde = max(1,stride(e,2))
info = Ref{BlasInt}()
ccall((:mb01oe_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{Float64}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Clong, Clong), uplo, trans, n, alpha,
beta, r, ldr, h, ldh, e, lde, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01oh!(uplo::AbstractChar, trans::AbstractChar, n::Integer,
alpha::Number, beta::Number, r::AbstractMatrix{Float64},
h::AbstractMatrix{Float64}, a::AbstractMatrix{Float64})
ldr = max(1,stride(r,2))
ldh = max(1,stride(h,2))
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
ccall((:mb01oh_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{Float64}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Clong, Clong), uplo, trans, n, alpha,
beta, r, ldr, h, ldh, a, lda, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01oo!(uplo::AbstractChar, trans::AbstractChar, n::Integer,
h::AbstractMatrix{Float64}, x::AbstractMatrix{Float64},
e::AbstractMatrix{Float64}, p::AbstractMatrix{Float64})
ldh = max(1,stride(h,2))
ldx = max(1,stride(x,2))
lde = max(1,stride(e,2))
ldp = max(1,stride(p,2))
info = Ref{BlasInt}()
ccall((:mb01oo_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), uplo, trans,
n, h, ldh, x, ldx, e, lde, p, ldp, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01os!(uplo::AbstractChar, trans::AbstractChar, n::Integer,
h::AbstractMatrix{Float64}, x::AbstractMatrix{Float64},
p::AbstractMatrix{Float64})
ldh = max(1,stride(h,2))
ldx = max(1,stride(x,2))
ldp = max(1,stride(p,2))
info = Ref{BlasInt}()
ccall((:mb01os_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong), uplo, trans, n, h, ldh, x, ldx, p, ldp,
info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01ot!(uplo::AbstractChar, trans::AbstractChar, n::Integer,
alpha::Number, beta::Number, r::AbstractMatrix{Float64},
e::AbstractMatrix{Float64}, t::AbstractMatrix{Float64})
ldr = max(1,stride(r,2))
lde = max(1,stride(e,2))
ldt = max(1,stride(t,2))
info = Ref{BlasInt}()
ccall((:mb01ot_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{Float64}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Clong, Clong), uplo, trans, n, alpha,
beta, r, ldr, e, lde, t, ldt, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01pd!(scun::AbstractChar, type::AbstractChar, m::Integer,
n::Integer, kl::Integer, ku::Integer, anrm::Number, nbl::Integer,
nrows::Integer, a::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
ccall((:mb01pd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), scun, type,
m, n, kl, ku, anrm, nbl, nrows, a, lda, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01qd!(type::AbstractChar, m::Integer, n::Integer,
kl::Integer, ku::Integer, cfrom::Number, cto::Number,
nbl::Integer, nrows::Integer, a::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
ccall((:mb01qd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{Float64},
Ref{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong), type, m, n, kl, ku,
cfrom, cto, nbl, nrows, a, lda, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01rb!(side::AbstractChar, uplo::AbstractChar,
trans::AbstractChar, m::Integer, n::Integer, alpha::Number,
beta::Number, r::AbstractMatrix{Float64},
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64})
ldr = max(1,stride(r,2))
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
ccall((:mb01rb_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{Float64},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong, Clong), side, uplo, trans, m, n, alpha,
beta, r, ldr, a, lda, b, ldb, info, 1, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01rd!(uplo::AbstractChar, trans::AbstractChar, m::Integer,
n::Integer, alpha::Number, beta::Number,
r::AbstractMatrix{Float64}, a::AbstractMatrix{Float64},
x::AbstractMatrix{Float64}, ldwork::Integer)
ldr = max(1,stride(r,2))
lda = max(1,stride(a,2))
ldx = max(1,stride(x,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb01rd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{Float64}, Ref{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong, Clong), uplo, trans, m, n, alpha,
beta, r, ldr, a, lda, x, ldx, dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01rh!(uplo::AbstractChar, trans::AbstractChar, n::Integer,
alpha::Number, beta::Number, r::AbstractMatrix{Float64},
h::AbstractMatrix{Float64}, x::AbstractMatrix{Float64},
ldwork::Integer)
ldr = max(1,stride(r,2))
ldh = max(1,stride(h,2))
ldx = max(1,stride(x,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb01rh_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{Float64}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong), uplo, trans, n, alpha, beta, r, ldr, h,
ldh, x, ldx, dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01rt!(uplo::AbstractChar, trans::AbstractChar, n::Integer,
alpha::Number, beta::Number, r::AbstractMatrix{Float64},
e::AbstractMatrix{Float64}, x::AbstractMatrix{Float64},
ldwork::Integer)
ldr = max(1,stride(r,2))
lde = max(1,stride(e,2))
ldx = max(1,stride(x,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb01rt_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{Float64}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong), uplo, trans, n, alpha, beta, r, ldr, e,
lde, x, ldx, dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01ru!(uplo::AbstractChar, trans::AbstractChar, m::Integer,
n::Integer, alpha::Number, beta::Number,
r::AbstractMatrix{Float64}, a::AbstractMatrix{Float64},
x::AbstractMatrix{Float64}, ldwork::Integer)
ldr = max(1,stride(r,2))
lda = max(1,stride(a,2))
ldx = max(1,stride(x,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb01ru_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{Float64}, Ref{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong, Clong), uplo, trans, m, n, alpha,
beta, r, ldr, a, lda, x, ldx, dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01rw!(uplo::AbstractChar, trans::AbstractChar, m::Integer,
n::Integer, a::AbstractMatrix{Float64},
z::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldz = max(1,stride(z,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, n)
ccall((:mb01rw_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{BlasInt},
Clong, Clong), uplo, trans, m, n, a, lda, z, ldz, dwork,
info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01rx!(side::AbstractChar, uplo::AbstractChar,
trans::AbstractChar, m::Integer, n::Integer, alpha::Number,
beta::Number, r::AbstractMatrix{Float64},
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64})
ldr = max(1,stride(r,2))
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
ccall((:mb01rx_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{Float64},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong, Clong), side, uplo, trans, m, n, alpha,
beta, r, ldr, a, lda, b, ldb, info, 1, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01ry!(side::AbstractChar, uplo::AbstractChar,
trans::AbstractChar, m::Integer, alpha::Number, beta::Number,
r::AbstractMatrix{Float64}, h::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, dwork::AbstractVector{Float64})
ldr = max(1,stride(r,2))
ldh = max(1,stride(h,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
ccall((:mb01ry_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ref{Float64}, Ref{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{BlasInt},
Clong, Clong, Clong), side, uplo, trans, m, alpha, beta,
r, ldr, h, ldh, b, ldb, dwork, info, 1, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb01sd!(jobs::AbstractChar, m::Integer, n::Integer,
a::AbstractMatrix{Float64}, r::AbstractVector{Float64},
c::AbstractVector{Float64})
lda = max(1,stride(a,2))
ccall((:mb01sd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Clong), jobs, m, n, a, lda, r, c, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb01ss!(jobs::AbstractChar, uplo::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, d::AbstractVector{Float64})
lda = max(1,stride(a,2))
ccall((:mb01ss_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Clong, Clong), jobs, uplo, n, a, lda, d, 1, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01td!(n::Integer, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, n-1)
ccall((:mb01td_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{BlasInt}), n, a, lda, b, ldb, dwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01ud!(side::AbstractChar, trans::AbstractChar, m::Integer,
n::Integer, alpha::Number, h::AbstractMatrix{Float64},
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64})
ldh = max(1,stride(h,2))
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
ccall((:mb01ud_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), side, trans,
m, n, alpha, h, ldh, a, lda, b, ldb, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01uw!(side::AbstractChar, trans::AbstractChar, m::Integer,
n::Integer, alpha::Number, h::AbstractMatrix{Float64},
a::AbstractMatrix{Float64}, ldwork::Integer)
ldh = max(1,stride(h,2))
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb01uw_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), side, trans,
m, n, alpha, h, ldh, a, lda, dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01ux!(side::AbstractChar, uplo::AbstractChar,
trans::AbstractChar, m::Integer, n::Integer, alpha::Number,
t::AbstractMatrix{Float64}, a::AbstractMatrix{Float64})
ldt = max(1,stride(t,2))
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb01ux_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong,
Clong), side, uplo, trans, m, n, alpha, t, ldt, a, lda,
dwork, ldwork, info, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (mc, nc, info)
"""
function mb01vd!(trana::AbstractChar, tranb::AbstractChar,
ma::Integer, na::Integer, mb::Integer, nb::Integer, alpha::Number,
beta::Number, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, c::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldc = max(1,stride(c,2))
mc = Ref{BlasInt}()
nc = Ref{BlasInt}()
info = Ref{BlasInt}()
ccall((:mb01vd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{Float64}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Clong, Clong),
trana, tranb, ma, na, mb, nb, alpha, beta, a, lda, b,
ldb, c, ldc, mc, nc, info, 1, 1)
chkargsok(info[])
return mc[], nc[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01wd!(dico::AbstractChar, uplo::AbstractChar,
trans::AbstractChar, hess::AbstractChar, n::Integer,
alpha::Number, beta::Number, r::AbstractMatrix{Float64},
a::AbstractMatrix{Float64}, t::AbstractMatrix{Float64})
ldr = max(1,stride(r,2))
lda = max(1,stride(a,2))
ldt = max(1,stride(t,2))
info = Ref{BlasInt}()
ccall((:mb01wd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{BlasInt}, Ref{Float64},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong, Clong, Clong), dico, uplo, trans, hess, n,
alpha, beta, r, ldr, a, lda, t, ldt, info, 1, 1, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01xd!(uplo::AbstractChar, n::Integer,
a::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
ccall((:mb01xd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong), uplo,
n, a, lda, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01xy!(uplo::AbstractChar, n::Integer,
a::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
ccall((:mb01xy_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong), uplo,
n, a, lda, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01yd!(uplo::AbstractChar, trans::AbstractChar, n::Integer,
k::Integer, l::Integer, alpha::Number, beta::Number,
a::AbstractMatrix{Float64}, c::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldc = max(1,stride(c,2))
info = Ref{BlasInt}()
ccall((:mb01yd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{Float64},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), uplo, trans,
n, k, l, alpha, beta, a, lda, c, ldc, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb01zd!(side::AbstractChar, uplo::AbstractChar,
transt::AbstractChar, diag::AbstractChar, m::Integer, n::Integer,
l::Integer, alpha::Number, t::AbstractMatrix{Float64},
h::AbstractMatrix{Float64})
ldt = max(1,stride(t,2))
ldh = max(1,stride(h,2))
info = Ref{BlasInt}()
ccall((:mb01zd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong,
Clong, Clong), side, uplo, transt, diag, m, n, l, alpha,
t, ldt, h, ldh, info, 1, 1, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02cd!(job::AbstractChar, typet::AbstractChar, k::Integer,
n::Integer, t::AbstractMatrix{Float64},
g::AbstractMatrix{Float64}, r::AbstractMatrix{Float64},
l::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
lcs::Integer, ldwork::Integer)
ldt = max(1,stride(t,2))
ldg = max(1,stride(g,2))
ldr = max(1,stride(r,2))
ldl = max(1,stride(l,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb02cd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong),
job, typet, k, n, t, ldt, g, ldg, r, ldr, l, ldl, cs,
lcs, dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (rnk, info)
"""
function mb02cu!(typeg::AbstractChar, k::Integer, p::Integer,
q::Integer, nb::Integer, a1::AbstractMatrix{Float64},
a2::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
ipvt::AbstractVector{BlasInt}, cs::AbstractVector{Float64},
tol::Number, ldwork::Integer)
lda1 = max(1,stride(a1,2))
lda2 = max(1,stride(a2,2))
ldb = max(1,stride(b,2))
rnk = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb02cu_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong), typeg, k, p, q, nb, a1, lda1, a2, lda2, b, ldb,
rnk, ipvt, cs, tol, dwork, ldwork, info, 1)
chkargsok(info[])
return rnk[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02cv!(typeg::AbstractChar, strucg::AbstractChar,
k::Integer, n::Integer, p::Integer, q::Integer, nb::Integer,
rnk::Integer, a1::AbstractMatrix{Float64},
a2::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
f1::AbstractMatrix{Float64}, f2::AbstractMatrix{Float64},
g::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
ldwork::Integer)
lda1 = max(1,stride(a1,2))
lda2 = max(1,stride(a2,2))
ldb = max(1,stride(b,2))
ldf1 = max(1,stride(f1,2))
ldf2 = max(1,stride(f2,2))
ldg = max(1,stride(g,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb02cv_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), typeg,
strucg, k, n, p, q, nb, rnk, a1, lda1, a2, lda2, b, ldb,
f1, ldf1, f2, ldf2, g, ldg, cs, dwork, ldwork, info, 1,
1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02cx!(typet::AbstractChar, p::Integer, q::Integer,
k::Integer, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
lcs::Integer, ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb02cx_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong), typet,
p, q, k, a, lda, b, ldb, cs, lcs, dwork, ldwork, info,
1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02cy!(typet::AbstractChar, strucg::AbstractChar,
p::Integer, q::Integer, n::Integer, k::Integer,
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
h::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
lcs::Integer, ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldh = max(1,stride(h,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb02cy_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong),
typet, strucg, p, q, n, k, a, lda, b, ldb, h, ldh, cs,
lcs, dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02dd!(job::AbstractChar, typet::AbstractChar, k::Integer,
m::Integer, n::Integer, ta::AbstractMatrix{Float64},
t::AbstractMatrix{Float64}, g::AbstractMatrix{Float64},
r::AbstractMatrix{Float64}, l::AbstractMatrix{Float64},
cs::AbstractVector{Float64}, ldwork::Integer)
ldta = max(1,stride(ta,2))
ldt = max(1,stride(t,2))
ldg = max(1,stride(g,2))
ldr = max(1,stride(r,2))
ldl = max(1,stride(l,2))
lcs = length(cs)
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb02dd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), job, typet,
k, m, n, ta, ldta, t, ldt, g, ldg, r, ldr, l, ldl, cs,
lcs, dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02ed!(typet::AbstractChar, k::Integer, n::Integer,
nrhs::Integer, t::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, ldwork::Integer)
ldt = max(1,stride(t,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb02ed_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong), typet, k, n, nrhs, t, ldt, b, ldb,
dwork, ldwork, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02fd!(typet::AbstractChar, k::Integer, n::Integer,
p::Integer, s::Integer, t::AbstractMatrix{Float64},
r::AbstractMatrix{Float64}, ldwork::Integer)
ldt = max(1,stride(t,2))
ldr = max(1,stride(r,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb02fd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong), typet, k, n, p, s,
t, ldt, r, ldr, dwork, ldwork, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02gd!(typet::AbstractChar, triu::AbstractChar, k::Integer,
n::Integer, nl::Integer, p::Integer, s::Integer,
t::AbstractMatrix{Float64}, rb::AbstractMatrix{Float64})
ldt = max(1,stride(t,2))
ldrb = max(1,stride(rb,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb02gd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong), typet, triu, k, n, nl, p, s, t, ldt, rb,
ldrb, dwork, ldwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02hd!(triu::AbstractChar, k::Integer, l::Integer,
m::Integer, ml::Integer, n::Integer, nu::Integer, p::Integer,
s::Integer, tc::AbstractMatrix{Float64},
tr::AbstractMatrix{Float64}, rb::AbstractMatrix{Float64})
ldtc = max(1,stride(tc,2))
ldtr = max(1,stride(tr,2))
ldrb = max(1,stride(rb,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb02hd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong), triu, k, l, m, ml, n, nu, p, s, tc, ldtc, tr,
ldtr, rb, ldrb, dwork, ldwork, info, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02id!(job::AbstractChar, k::Integer, l::Integer,
m::Integer, n::Integer, rb::Integer, rc::Integer,
tc::AbstractMatrix{Float64}, tr::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, c::AbstractMatrix{Float64})
ldtc = max(1,stride(tc,2))
ldtr = max(1,stride(tr,2))
ldb = max(1,stride(b,2))
ldc = max(1,stride(c,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb02id_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong), job, k, l, m, n, rb, rc, tc, ldtc, tr, ldtr, b,
ldb, c, ldc, dwork, ldwork, info, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02jd!(job::AbstractChar, k::Integer, l::Integer,
m::Integer, n::Integer, p::Integer, s::Integer,
tc::AbstractMatrix{Float64}, tr::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, r::AbstractMatrix{Float64})
ldtc = max(1,stride(tc,2))
ldtr = max(1,stride(tr,2))
ldq = max(1,stride(q,2))
ldr = max(1,stride(r,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb02jd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong), job, k, l, m, n, p, s, tc, ldtc, tr, ldtr, q,
ldq, r, ldr, dwork, ldwork, info, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (rnk, info)
"""
function mb02jx!(job::AbstractChar, k::Integer, l::Integer,
m::Integer, n::Integer, tc::AbstractMatrix{Float64},
tr::AbstractMatrix{Float64}, q::AbstractMatrix{Float64},
r::AbstractMatrix{Float64}, jpvt::AbstractVector{BlasInt},
tol1::Number, tol2::Number, ldwork::Integer)
ldtc = max(1,stride(tc,2))
ldtr = max(1,stride(tr,2))
ldq = max(1,stride(q,2))
ldr = max(1,stride(r,2))
rnk = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb02jx_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ref{Float64}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong), job, k, l, m, n, tc,
ldtc, tr, ldtr, rnk, q, ldq, r, ldr, jpvt, tol1, tol2,
dwork, ldwork, info, 1)
chkargsok(info[])
return rnk[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02kd!(ldblk::AbstractChar, trans::AbstractChar, k::Integer,
l::Integer, m::Integer, n::Integer, r::Integer, alpha::Number,
beta::Number, tc::AbstractMatrix{Float64},
tr::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
c::AbstractMatrix{Float64})
ldtc = max(1,stride(tc,2))
ldtr = max(1,stride(tr,2))
ldb = max(1,stride(b,2))
ldc = max(1,stride(c,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb02kd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{Float64}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), ldblk, trans,
k, l, m, n, r, alpha, beta, tc, ldtc, tr, ldtr, b, ldb,
c, ldc, dwork, ldwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (rank, info, iwarn)
"""
function mb02md!(job::AbstractChar, m::Integer, n::Integer,
l::Integer, ini_rank::Integer, c::AbstractMatrix{Float64},
s::AbstractVector{Float64}, x::AbstractMatrix{Float64},
tol::Number)
ldc = max(1,stride(c,2))
ldx = max(1,stride(x,2))
rank = Ref{BlasInt}(ini_rank)
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, l)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb02md_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ref{Float64}, Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Clong), job, m, n, l, rank,
c, ldc, s, x, ldx, tol, iwork, dwork, ldwork, iwarn,
info, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return rank[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns (rank, theta, info, iwarn)
"""
function mb02nd!(m::Integer, n::Integer, l::Integer,
ini_rank::Integer, ini_theta::Number, c::AbstractMatrix{Float64},
x::AbstractMatrix{Float64}, q::AbstractVector{Float64},
inul::AbstractVector{BlasBool}, tol::Number, reltol::Number)
ldc = max(1,stride(c,2))
ldx = max(1,stride(x,2))
rank = Ref{BlasInt}(ini_rank)
theta = Ref{Float64}(ini_theta)
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n+2*l)
bwork = Vector{BlasBool}(undef, n+l)
ldwork = BlasInt(-1)
# some of this is used even in the workspace query
dwork = Vector{Float64}(undef, 64)
local jlres
for iwq in 1:2
ccall((:mb02nd_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{BlasBool}, Ref{Float64}, Ref{Float64}, Ptr{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasBool}, Ptr{BlasInt},
Ptr{BlasInt}), m, n, l, rank, theta, c, ldc, x, ldx, q,
inul, tol, reltol, iwork, dwork, ldwork, bwork, iwarn,
info)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return rank[], theta[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb02ny!(updatu::Bool, updatv::Bool, m::Integer, n::Integer,
i::Integer, k::Integer, q::AbstractVector{Float64},
e::AbstractVector{Float64}, u::AbstractMatrix{Float64},
v::AbstractMatrix{Float64})
ldu = max(1,stride(u,2))
ldv = max(1,stride(v,2))
dwork = Vector{Float64}(undef, max(1,ldwork))
ccall((:mb02ny_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}), updatu,
updatv, m, n, i, k, q, e, u, ldu, v, ldv, dwork)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns (rcond, info)
"""
function mb02od!(side::AbstractChar, uplo::AbstractChar,
trans::AbstractChar, diag::AbstractChar, norm::AbstractChar,
m::Integer, n::Integer, alpha::Number, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, tol::Number)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
rcond = Ref{Float64}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, k)
dwork = Vector{Float64}(undef, 3*k)
ccall((:mb02od_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{Float64},
Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt}, Clong, Clong,
Clong, Clong, Clong), side, uplo, trans, diag, norm, m,
n, alpha, a, lda, b, ldb, rcond, tol, iwork, dwork,
info, 1, 1, 1, 1, 1)
chkargsok(info[])
return rcond[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (rcond, info)
"""
function mb02pd!(fact::AbstractChar, trans::AbstractChar, n::Integer,
nrhs::Integer, a::AbstractMatrix{Float64},
af::AbstractMatrix{Float64}, ipiv::AbstractVector{BlasInt},
equed::AbstractChar, r::AbstractVector{Float64},
c::AbstractVector{Float64}, b::AbstractMatrix{Float64},
x::AbstractMatrix{Float64}, ferr::AbstractVector{Float64},
berr::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldaf = max(1,stride(af,2))
ldb = max(1,stride(b,2))
ldx = max(1,stride(x,2))
rcond = Ref{Float64}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n)
dwork = Vector{Float64}(undef, 4*n)
ccall((:mb02pd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ref{UInt8},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt},
Clong, Clong, Clong), fact, trans, n, nrhs, a, lda, af,
ldaf, ipiv, equed, r, c, b, ldb, x, ldx, rcond, ferr,
berr, iwork, dwork, info, 1, 1, 1)
chkargsok(info[])
return rcond[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (rank, info)
"""
function mb02qd!(job::AbstractChar, iniper::AbstractChar, m::Integer,
n::Integer, nrhs::Integer, rcond::Number, svlmax::Number,
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64}, y::AbstractVector{Float64},
jpvt::AbstractVector{BlasInt}, sval::AbstractVector{Float64},
ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
rank = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb02qd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{Float64},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ptr{BlasInt}, Ptr{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong), job, iniper, m, n, nrhs, rcond, svlmax,
a, lda, b, ldb, y, jpvt, rank, sval, dwork, ldwork,
info, 1, 1)
chkargsok(info[])
return rank[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02qy!(m::Integer, n::Integer, nrhs::Integer, rank::Integer,
a::AbstractMatrix{Float64},
jpvt::AbstractVector{BlasInt}, b::AbstractMatrix{Float64},
tau::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(a,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork )
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb02qy_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}), m, n, nrhs,
rank, a, lda, jpvt, b, ldb, tau, dwork, ldwork, info)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02rd!(trans::AbstractChar, n::Integer, nrhs::Integer,
h::AbstractMatrix{Float64}, ipiv::AbstractVector{BlasInt},
b::AbstractMatrix{Float64})
ldh = max(1,stride(h,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
ccall((:mb02rd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong), trans,
n, nrhs, h, ldh, ipiv, b, ldb, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02rz!(trans::AbstractChar, n::Integer, nrhs::Integer,
h::AbstractMatrix{ComplexF64}, ipiv::AbstractVector{BlasInt},
b::AbstractMatrix{ComplexF64})
ldh = max(1,stride(h,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
ccall((:mb02rz_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{BlasInt}, Clong), trans, n, nrhs, h, ldh, ipiv, b,
ldb, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02sd!(n::Integer, h::AbstractMatrix{Float64},
ipiv::AbstractVector{BlasInt})
ldh = max(1,stride(h,2))
info = Ref{BlasInt}()
ccall((:mb02sd_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}), n, h, ldh,
ipiv, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02sz!(n::Integer, h::AbstractMatrix{ComplexF64},
ipiv::AbstractVector{BlasInt})
ldh = max(1,stride(h,2))
info = Ref{BlasInt}()
ccall((:mb02sz_, libslicot), Cvoid, (Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}), n, h, ldh, ipiv, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (rcond, info)
"""
function mb02td!(norm::AbstractChar, n::Integer, hnorm::Number,
h::AbstractMatrix{Float64}, ipiv::AbstractVector{BlasInt})
ldh = max(1,stride(h,2))
rcond = Ref{Float64}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n)
dwork = Vector{Float64}(undef, 3*n)
ccall((:mb02td_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt},
Clong), norm, n, hnorm, h, ldh, ipiv, rcond, iwork,
dwork, info, 1)
chkargsok(info[])
return rcond[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (rcond, info)
"""
function mb02tz!(norm::AbstractChar, n::Integer, hnorm::Number,
h::AbstractMatrix{ComplexF64}, ipiv::AbstractVector{BlasInt})
ldh = max(1,stride(h,2))
rcond = Ref{Float64}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, n)
zwork = Vector{ComplexF64}(undef, 2*n)
ccall((:mb02tz_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{Float64}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{ComplexF64}, Ptr{BlasInt}, Clong), norm, n, hnorm,
h, ldh, ipiv, rcond, dwork, zwork, info, 1)
chkargsok(info[])
return rcond[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02ud!(fact::AbstractChar, side::AbstractChar,
trans::AbstractChar, jobp::AbstractChar, m::Integer, n::Integer,
alpha::Number, rcond::Number, rank::Integer,
r::AbstractMatrix{Float64}, q::AbstractMatrix{Float64},
sv::AbstractVector{Float64}, b::AbstractMatrix{Float64},
rp::AbstractMatrix{Float64})
ldr = max(1,stride(r,2))
ldq = max(1,stride(q,2))
ldb = max(1,stride(b,2))
ldrp = max(1,stride(rp,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb02ud_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt},
Ref{Float64}, Ref{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong,
Clong, Clong), fact, side, trans, jobp, m, n, alpha,
rcond, rank, r, ldr, q, ldq, sv, b, ldb, rp, ldrp,
dwork, ldwork, info, 1, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns scale
"""
function mb02uu!(n::Integer, a::AbstractMatrix{Float64},
rhs::AbstractVector{Float64}, ipiv::AbstractVector{BlasInt},
jpiv::AbstractVector{BlasInt})
lda = max(1,stride(a,2))
scale = Ref{Float64}()
ccall((:mb02uu_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ptr{BlasInt}, Ptr{BlasInt},
Ptr{Float64}), n, a, lda, rhs, ipiv, jpiv, scale)
return scale[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02uv!(n::Integer, a::AbstractMatrix{Float64},
ipiv::AbstractVector{BlasInt}, jpiv::AbstractVector{BlasInt})
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
ccall((:mb02uv_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}),
n, a, lda, ipiv, jpiv, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (scale, iwarn)
"""
function mb02uw!(ltrans::Bool, n::Integer, m::Integer,
par::AbstractVector{Float64}, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
scale = Ref{Float64}()
iwarn = Ref{BlasInt}()
ccall((:mb02uw_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{BlasInt}),
ltrans, n, m, par, a, lda, b, ldb, scale, iwarn)
return scale[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02vd!(trans::AbstractChar, m::Integer, n::Integer,
a::AbstractMatrix{Float64}, ipiv::AbstractVector{BlasInt},
b::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
ccall((:mb02vd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong), trans,
m, n, a, lda, ipiv, b, ldb, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb02yd!(cond::AbstractChar, n::Integer,
r::AbstractMatrix{Float64}, ipvt::AbstractVector{BlasInt},
diag::AbstractVector{Float64}, qtb::AbstractVector{Float64},
rank::Integer, x::AbstractVector{Float64}, tol::Number,
ldwork::Integer)
ldr = max(1,stride(r,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb02yd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong), cond,
n, r, ldr, ipvt, diag, qtb, rank, x, tol, dwork, ldwork,
info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (c1, s1, c2, s2)
"""
function mb03ab!(shft::AbstractChar, k::Integer, n::Integer,
amap::AbstractVector{BlasInt}, s::AbstractVector{BlasInt},
sinv::Integer, a::Array{Float64,3},
w1::Number, w2::Number)
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
c1 = Ref{Float64}()
s1 = Ref{Float64}()
c2 = Ref{Float64}()
s2 = Ref{Float64}()
ccall((:mb03ab_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ref{Float64},
Ref{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Clong), shft, k, n, amap, s, sinv, a,
lda1, lda2, w1, w2, c1, s1, c2, s2, 1)
return c1[], s1[], c2[], s2[]
end
"""
$(TYPEDSIGNATURES)
returns (c1, s1, c2, s2)
"""
function mb03ad!(shft::AbstractChar, k::Integer, n::Integer,
amap::AbstractVector{BlasInt}, s::AbstractVector{BlasInt},
sinv::Integer, a::Array{Float64,3})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
c1 = Ref{Float64}()
s1 = Ref{Float64}()
c2 = Ref{Float64}()
s2 = Ref{Float64}()
ccall((:mb03ad_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Clong), shft,
k, n, amap, s, sinv, a, lda1, lda2, c1, s1, c2, s2, 1)
return c1[], s1[], c2[], s2[]
end
"""
$(TYPEDSIGNATURES)
returns (c1, s1, c2, s2)
"""
function mb03ae!(shft::AbstractChar, k::Integer, n::Integer,
amap::AbstractVector{BlasInt}, s::AbstractVector{BlasInt},
sinv::Integer, a::Array{Float64,3})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
c1 = Ref{Float64}()
s1 = Ref{Float64}()
c2 = Ref{Float64}()
s2 = Ref{Float64}()
ccall((:mb03ae_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Clong), shft,
k, n, amap, s, sinv, a, lda1, lda2, c1, s1, c2, s2, 1)
return c1[], s1[], c2[], s2[]
end
"""
$(TYPEDSIGNATURES)
returns (c1, s1, c2, s2)
"""
function mb03af!(shft::AbstractChar, k::Integer, n::Integer,
amap::AbstractVector{BlasInt}, s::AbstractVector{BlasInt},
sinv::Integer, a::Array{Float64,3})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
c1 = Ref{Float64}()
s1 = Ref{Float64}()
c2 = Ref{Float64}()
s2 = Ref{Float64}()
ccall((:mb03af_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Clong), shft,
k, n, amap, s, sinv, a, lda1, lda2, c1, s1, c2, s2, 1)
return c1[], s1[], c2[], s2[]
end
"""
$(TYPEDSIGNATURES)
returns (c1, s1, c2, s2)
"""
function mb03ag!(shft::AbstractChar, k::Integer, n::Integer,
amap::AbstractVector{BlasInt}, s::AbstractVector{BlasInt},
sinv::Integer, a::Array{Float64,3})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
c1 = Ref{Float64}()
s1 = Ref{Float64}()
c2 = Ref{Float64}()
s2 = Ref{Float64}()
iwork = Vector{BlasInt}(undef, 2*n)
dwork = Vector{Float64}(undef, 2*n*n)
ccall((:mb03ag_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ptr{Float64}, Clong), shft, k, n, amap, s, sinv, a,
lda1, lda2, c1, s1, c2, s2, iwork, dwork, 1)
return c1[], s1[], c2[], s2[]
end
"""
$(TYPEDSIGNATURES)
returns (c1, s1, c2, s2)
"""
function mb03ah!(shft::AbstractChar, k::Integer, n::Integer,
amap::AbstractVector{BlasInt}, s::AbstractVector{BlasInt},
sinv::Integer, a::Array{Float64,3})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
c1 = Ref{Float64}()
s1 = Ref{Float64}()
c2 = Ref{Float64}()
s2 = Ref{Float64}()
ccall((:mb03ah_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Clong), shft,
k, n, amap, s, sinv, a, lda1, lda2, c1, s1, c2, s2, 1)
return c1[], s1[], c2[], s2[]
end
"""
$(TYPEDSIGNATURES)
returns (c1, s1, c2, s2)
"""
function mb03ai!(shft::AbstractChar, k::Integer, n::Integer,
amap::AbstractVector{BlasInt}, s::AbstractVector{BlasInt},
sinv::Integer, a::Array{Float64,3})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
c1 = Ref{Float64}()
s1 = Ref{Float64}()
c2 = Ref{Float64}()
s2 = Ref{Float64}()
dwork = Vector{Float64}(undef, n*(n+2))
ccall((:mb03ai_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Clong), shft, k, n, amap, s, sinv, a, lda1, lda2, c1,
s1, c2, s2, dwork, 1)
return c1[], s1[], c2[], s2[]
end
"""
$(TYPEDSIGNATURES)
returns smult
"""
function mb03ba!(k::Integer, h::Integer, s::AbstractVector{BlasInt},
amap::AbstractVector{BlasInt}, qmap::AbstractVector{BlasInt})
smult = Ref{BlasInt}()
ccall((:mb03ba_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}),
k, h, s, smult, amap, qmap)
return smult[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03bb!(base::Number, lgbas::Number, ulp::Number, k::Integer,
amap::AbstractVector{BlasInt}, s::AbstractVector{BlasInt},
sinv::Integer, a::Array{Float64,3},
alphar::AbstractVector{Float64}, alphai::AbstractVector{Float64},
beta::AbstractVector{Float64}, scal::AbstractVector{BlasInt})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, 8*k)
ccall((:mb03bb_, libslicot), Cvoid, (Ref{Float64}, Ref{Float64},
Ref{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ptr{Float64}, Ptr{BlasInt}), base, lgbas, ulp, k, amap,
s, sinv, a, lda1, lda2, alphar, alphai, beta, scal,
dwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb03bc!(k::Integer, amap::AbstractVector{BlasInt},
s::AbstractVector{BlasInt}, sinv::Integer, a::Array{Float64,3},
macpar::AbstractVector{Float64},
cv::AbstractVector{Float64}, sv::AbstractVector{Float64})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
dwork = Vector{Float64}(undef, 3*(k-1))
ccall((:mb03bc_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}), k, amap, s, sinv, a, lda1, lda2, macpar,
cv, sv, dwork)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns (info, iwarn)
"""
function mb03bd!(job::AbstractChar, defl::AbstractChar,
compq::AbstractChar, qind::AbstractVector{BlasInt}, k::Integer,
n::Integer, h::Integer, ilo::Integer, ihi::Integer,
s::AbstractVector{BlasInt}, a::Array{Float64,3},
q::Array{Float64,3},
alphar::AbstractVector{Float64}, alphai::AbstractVector{Float64},
beta::AbstractVector{Float64}, scal::AbstractVector{BlasInt},
liwork::Integer, ldwork::Integer)
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
ldq1 = max(1,stride(q,2))
ldq2 = max(1,stride(q,3)÷ldq1)
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03bd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ptr{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt},
Clong, Clong, Clong), job, defl, compq, qind, k, n, h,
ilo, ihi, s, a, lda1, lda2, q, ldq1, ldq2, alphar,
alphai, beta, scal, iwork, liwork, dwork, ldwork, iwarn,
info, 1, 1, 1)
chkargsok(info[])
return info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb03be!(k::Integer, amap::AbstractVector{BlasInt},
s::AbstractVector{BlasInt}, sinv::Integer, a::Array{Float64,3})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
ccall((:mb03be_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ref{BlasInt}), k, amap, s, sinv, a, lda1, lda2)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb03bf!(k::Integer, amap::AbstractVector{BlasInt},
s::AbstractVector{BlasInt}, sinv::Integer, a::Array{Float64,3},
ulp::Number)
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
ccall((:mb03bf_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ref{BlasInt}, Ref{Float64}), k, amap, s, sinv, a, lda1,
lda2, ulp)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03bg!(k::Integer, n::Integer,
amap::AbstractVector{BlasInt}, s::AbstractVector{BlasInt},
sinv::Integer, a::Array{Float64,3},
wr::AbstractVector{Float64}, wi::AbstractVector{Float64})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
info = Ref{BlasInt}()
ccall((:mb03bg_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}),
k, n, amap, s, sinv, a, lda1, lda2, wr, wi)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03bz!(job::AbstractChar, compq::AbstractChar, k::Integer,
n::Integer, ilo::Integer, ihi::Integer,
s::AbstractVector{BlasInt}, a::Array{ComplexF64,3}, q::Array{ComplexF64,3},
alpha::AbstractVector{ComplexF64},
beta::AbstractVector{ComplexF64}, scal::AbstractVector{BlasInt},
ldwork::Integer, lzwork::Integer)
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
ldq1 = max(1,stride(q,2))
ldq2 = max(1,stride(q,3)÷ldq1)
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
zwork = Vector{ComplexF64}(undef, lzwork)
ccall((:mb03bz_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ref{BlasInt}, Ptr{ComplexF64}, Ptr{ComplexF64},
Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{BlasInt}, Clong,
Clong), job, compq, k, n, ilo, ihi, s, a, lda1, lda2, q,
ldq1, ldq2, alpha, beta, scal, dwork, ldwork, zwork,
lzwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (n1, n2, info)
"""
function mb03cd!(uplo::AbstractChar, ini_n1::Integer, ini_n2::Integer,
prec::Number, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, d::AbstractMatrix{Float64},
q1::AbstractMatrix{Float64}, q2::AbstractMatrix{Float64},
q3::AbstractMatrix{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldd = max(1,stride(d,2))
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
ldq3 = max(1,stride(q3,2))
n1 = Ref{BlasInt}(ini_n1)
n2 = Ref{BlasInt}(ini_n2)
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03cd_, libslicot), Cvoid, (Ref{UInt8}, Ptr{BlasInt},
Ptr{BlasInt}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong), uplo, n1, n2, prec, a, lda, b,
ldb, d, ldd, q1, ldq1, q2, ldq2, q3, ldq3, dwork,
ldwork, info, 1)
chkargsok(info[])
return n1[], n2[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (co1, si1, co2, si2, co3, si3)
"""
function mb03cz!(a::AbstractMatrix{ComplexF64},
b::AbstractMatrix{ComplexF64}, d::AbstractMatrix{ComplexF64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldd = max(1,stride(d,2))
co1 = Ref{Float64}()
si1 = Ref{ComplexF64}()
co2 = Ref{Float64}()
si2 = Ref{ComplexF64}()
co3 = Ref{Float64}()
si3 = Ref{ComplexF64}()
ccall((:mb03cz_, libslicot), Cvoid, (Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{Float64},
Ptr{ComplexF64}, Ptr{Float64}, Ptr{ComplexF64},
Ptr{Float64}, Ptr{ComplexF64}), a, lda, b, ldb, d, ldd,
co1, si1, co2, si2, co3, si3)
return co1[], si1[], co2[], si2[], co3[], si3[]
end
"""
$(TYPEDSIGNATURES)
returns (n1, n2, info)
"""
function mb03dd!(uplo::AbstractChar, ini_n1::Integer, ini_n2::Integer,
prec::Number, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, q1::AbstractMatrix{Float64},
q2::AbstractMatrix{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
n1 = Ref{BlasInt}(ini_n1)
n2 = Ref{BlasInt}(ini_n2)
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03dd_, libslicot), Cvoid, (Ref{UInt8}, Ptr{BlasInt},
Ptr{BlasInt}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong), uplo, n1, n2, prec, a, lda, b,
ldb, q1, ldq1, q2, ldq2, dwork, ldwork, info, 1)
chkargsok(info[])
return n1[], n2[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (co1, si1, co2, si2)
"""
function mb03dz!(a::AbstractMatrix{ComplexF64},
b::AbstractMatrix{ComplexF64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
co1 = Ref{Float64}()
si1 = Ref{ComplexF64}()
co2 = Ref{Float64}()
si2 = Ref{ComplexF64}()
ccall((:mb03dz_, libslicot), Cvoid, (Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{Float64}, Ptr{ComplexF64}, Ptr{Float64},
Ptr{ComplexF64}), a, lda, b, ldb, co1, si1, co2, si2)
return co1[], si1[], co2[], si2[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03ed!(n::Integer, prec::Number, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, d::AbstractMatrix{Float64},
q1::AbstractMatrix{Float64}, q2::AbstractMatrix{Float64},
q3::AbstractMatrix{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldd = max(1,stride(d,2))
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
ldq3 = max(1,stride(q3,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03ed_, libslicot), Cvoid, (Ref{BlasInt}, Ref{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}), n, prec, a,
lda, b, ldb, d, ldd, q1, ldq1, q2, ldq2, q3, ldq3,
dwork, ldwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03fd!(n::Integer, prec::Number, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, q1::AbstractMatrix{Float64},
q2::AbstractMatrix{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03fd_, libslicot), Cvoid, (Ref{BlasInt}, Ref{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}), n, prec, a,
lda, b, ldb, q1, ldq1, q2, ldq2, dwork, ldwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info)
"""
function mb03fz!(compq::AbstractChar, compu::AbstractChar,
orth::AbstractChar, n::Integer, z::AbstractMatrix{ComplexF64},
b::AbstractMatrix{ComplexF64}, fg::AbstractMatrix{ComplexF64},
d::AbstractMatrix{ComplexF64}, c::AbstractMatrix{ComplexF64},
q::AbstractMatrix{ComplexF64}, u::AbstractMatrix{ComplexF64},
alphar::AbstractVector{Float64}, alphai::AbstractVector{Float64},
beta::AbstractVector{Float64}, liwork::Integer,
bwork::AbstractVector{BlasBool})
ldz = max(1,stride(z,2))
ldb = max(1,stride(b,2))
ldfg = max(1,stride(fg,2))
ldd = max(1,stride(d,2))
ldc = max(1,stride(c,2))
ldq = max(1,stride(q,2))
ldu = max(1,stride(u,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
lzwork = BlasInt(-1)
zwork = Vector{ComplexF64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03fz_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{BlasBool}, Ptr{BlasInt},
Clong, Clong, Clong), compq, compu, orth, n, z, ldz, b,
ldb, fg, ldfg, neig, d, ldd, c, ldc, q, ldq, u, ldu,
alphar, alphai, beta, iwork, liwork, dwork, ldwork,
zwork, lzwork, bwork, info, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
lzwork = BlasInt(real(zwork[1]))
resize!(zwork, lzwork)
end
end
return neig[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03gd!(n::Integer, b::AbstractMatrix{Float64},
d::AbstractMatrix{Float64}, macpar::AbstractVector{Float64},
q::AbstractMatrix{Float64}, u::AbstractMatrix{Float64},
ldwork::Integer)
ldb = max(1,stride(b,2))
ldd = max(1,stride(d,2))
ldq = max(1,stride(q,2))
ldu = max(1,stride(u,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03gd_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}), n, b, ldb, d,
ldd, macpar, q, ldq, u, ldu, dwork, ldwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (co1, si1, co2, si2)
"""
function mb03gz!(z11::Complex, z12::Complex, z22::Complex,
h11::Complex, h12::Complex)
co1 = Ref{Float64}()
si1 = Ref{ComplexF64}()
co2 = Ref{Float64}()
si2 = Ref{ComplexF64}()
ccall((:mb03gz_, libslicot), Cvoid, (Ref{ComplexF64},
Ref{ComplexF64}, Ref{ComplexF64}, Ref{ComplexF64},
Ref{ComplexF64}, Ptr{Float64}, Ptr{ComplexF64},
Ptr{Float64}, Ptr{ComplexF64}), z11, z12, z22, h11, h12,
co1, si1, co2, si2)
return co1[], si1[], co2[], si2[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03hd!(n::Integer, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, macpar::AbstractVector{Float64},
q::AbstractMatrix{Float64}, dwork::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldq = max(1,stride(q,2))
info = Ref{BlasInt}()
ccall((:mb03hd_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{BlasInt}),
n, a, lda, b, ldb, macpar, q, ldq, dwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (co, si)
"""
function mb03hz!(s11::Complex, s12::Complex, h11::Complex,
h12::Complex)
co = Ref{Float64}()
si = Ref{ComplexF64}()
ccall((:mb03hz_, libslicot), Cvoid, (Ref{ComplexF64},
Ref{ComplexF64}, Ref{ComplexF64}, Ref{ComplexF64},
Ptr{Float64}, Ptr{ComplexF64}), s11, s12, h11, h12, co,
si)
return co[], si[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info)
"""
function mb03id!(compq::AbstractChar, compu::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, c::AbstractMatrix{Float64},
d::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
f::AbstractMatrix{Float64}, q::AbstractMatrix{Float64},
u1::AbstractMatrix{Float64}, u2::AbstractMatrix{Float64},
liwork::Integer, ldwork::Integer)
lda = max(1,stride(a,2))
ldc = max(1,stride(c,2))
ldd = max(1,stride(d,2))
ldb = max(1,stride(b,2))
ldf = max(1,stride(f,2))
ldq = max(1,stride(q,2))
ldu1 = max(1,stride(u1,2))
ldu2 = max(1,stride(u2,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03id_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong),
compq, compu, n, a, lda, c, ldc, d, ldd, b, ldb, f, ldf,
q, ldq, u1, ldu1, u2, ldu2, neig, iwork, liwork, dwork,
ldwork, info, 1, 1)
chkargsok(info[])
return neig[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info)
"""
function mb03iz!(compq::AbstractChar, compu::AbstractChar, n::Integer,
a::AbstractMatrix{ComplexF64}, c::AbstractMatrix{ComplexF64},
d::AbstractMatrix{ComplexF64}, b::AbstractMatrix{ComplexF64},
f::AbstractMatrix{ComplexF64}, q::AbstractMatrix{ComplexF64},
u1::AbstractMatrix{ComplexF64}, u2::AbstractMatrix{ComplexF64},
tol::Number)
lda = max(1,stride(a,2))
ldc = max(1,stride(c,2))
ldd = max(1,stride(d,2))
ldb = max(1,stride(b,2))
ldf = max(1,stride(f,2))
ldq = max(1,stride(q,2))
ldu1 = max(1,stride(u1,2))
ldu2 = max(1,stride(u2,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
ccall((:mb03iz_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{BlasInt},
Ref{Float64}, Ptr{BlasInt}, Clong, Clong), compq, compu,
n, a, lda, c, ldc, d, ldd, b, ldb, f, ldf, q, ldq, u1,
ldu1, u2, ldu2, neig, tol, info, 1, 1)
chkargsok(info[])
return neig[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info)
"""
function mb03jd!(compq::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, d::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, f::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, liwork::Integer, ldwork::Integer)
lda = max(1,stride(a,2))
ldd = max(1,stride(d,2))
ldb = max(1,stride(b,2))
ldf = max(1,stride(f,2))
ldq = max(1,stride(q,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03jd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong), compq, n, a, lda, d, ldd, b, ldb, f, ldf, q,
ldq, neig, iwork, liwork, dwork, ldwork, info, 1)
chkargsok(info[])
return neig[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info)
"""
function mb03jp!(compq::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, d::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, f::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, liwork::Integer, ldwork::Integer)
lda = max(1,stride(a,2))
ldd = max(1,stride(d,2))
ldb = max(1,stride(b,2))
ldf = max(1,stride(f,2))
ldq = max(1,stride(q,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03jp_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong), compq, n, a, lda, d, ldd, b, ldb, f, ldf, q,
ldq, neig, iwork, liwork, dwork, ldwork, info, 1)
chkargsok(info[])
return neig[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info)
"""
function mb03jz!(compq::AbstractChar, n::Integer,
a::AbstractMatrix{ComplexF64}, d::AbstractMatrix{ComplexF64},
b::AbstractMatrix{ComplexF64}, f::AbstractMatrix{ComplexF64},
q::AbstractMatrix{ComplexF64}, tol::Number)
lda = max(1,stride(a,2))
ldd = max(1,stride(d,2))
ldb = max(1,stride(b,2))
ldf = max(1,stride(f,2))
ldq = max(1,stride(q,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
ccall((:mb03jz_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{BlasInt}, Ref{Float64}, Ptr{BlasInt},
Clong), compq, n, a, lda, d, ldd, b, ldb, f, ldf, q,
ldq, neig, tol, info, 1)
chkargsok(info[])
return neig[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (ifst, ilst, info)
"""
function mb03ka!(compq::AbstractChar, whichq::AbstractVector{BlasInt},
ws::Bool, k::Integer, nc::Integer, kschur::Integer,
ini_ifst::Integer, ini_ilst::Integer, n::AbstractVector{BlasInt},
ni::AbstractVector{BlasInt}, s::AbstractVector{BlasInt},
t::AbstractVector{Float64}, ldt::AbstractVector{BlasInt},
ixt::AbstractVector{BlasInt}, q::AbstractVector{Float64},
ldq::AbstractVector{BlasInt}, ixq::AbstractVector{BlasInt},
tol::AbstractVector{Float64})
# NOTE: intentionally strange signature: `t,q` are vector holding 3d array
ifst = Ref{BlasInt}(ini_ifst)
ilst = Ref{BlasInt}(ini_ilst)
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, 4*k)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03ka_, libslicot), Cvoid, (Ref{UInt8}, Ptr{BlasInt},
Ref{BlasBool}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt}, Ptr{BlasInt},
Ptr{Float64}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong), compq, whichq, ws, k, nc, kschur, ifst, ilst, n,
ni, s, t, ldt, ixt, q, ldq, ixq, tol, iwork, dwork,
ldwork, info, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return ifst[], ilst[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03kb!(compq::AbstractChar, whichq::AbstractVector{BlasInt},
ws::Bool, k::Integer, nc::Integer, kschur::Integer, j1::Integer,
n1::Integer, n2::Integer, n::AbstractVector{BlasInt},
ni::AbstractVector{BlasInt}, s::AbstractVector{BlasInt},
t::AbstractVector{Float64}, ldt::AbstractVector{BlasInt},
ixt::AbstractVector{BlasInt}, q::AbstractVector{Float64},
ldq::AbstractVector{BlasInt}, ixq::AbstractVector{BlasInt},
tol::AbstractVector{Float64})
# NOTE: intentionally strange signature: `t,q` are vector holding 3d array
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, 4*k)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03kb_, libslicot), Cvoid, (Ref{UInt8}, Ptr{BlasInt},
Ref{BlasBool}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt}, Ptr{BlasInt},
Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong), compq, whichq, ws, k, nc, kschur,
j1, n1, n2, n, ni, s, t, ldt, ixt, q, ldq, ixq, tol,
iwork, dwork, ldwork, info, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb03kc!(k::Integer, khess::Integer, n::Integer, r::Integer,
s::AbstractVector{BlasInt}, a::AbstractVector{Float64},
lda::Integer, v::AbstractVector{Float64},
tau::AbstractVector{Float64})
# NOTE: intentionally strange signature: `a` is vector holding 3d array
ccall((:mb03kc_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}), k, khess, n,
r, s, a, lda, v, tau)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns (m, info)
"""
function mb03kd!(compq::AbstractChar, whichq::AbstractVector{BlasInt},
strong::AbstractChar, k::Integer, nc::Integer, kschur::Integer,
n::AbstractVector{BlasInt}, ni::AbstractVector{BlasInt},
s::AbstractVector{BlasInt}, select::AbstractVector{BlasBool},
t::AbstractVector{Float64}, ldt::AbstractVector{BlasInt},
ixt::AbstractVector{BlasInt}, q::AbstractVector{Float64},
ldq::AbstractVector{BlasInt}, ixq::AbstractVector{BlasInt},
tol::Number)
# NOTE: intentionally strange signature: `t,q` are vector holding 3d array
m = Ref{BlasInt}()
info = Ref{BlasInt}(0)
iwork = Vector{BlasInt}(undef, 4*k)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03kd_, libslicot), Cvoid, (Ref{UInt8}, Ptr{BlasInt},
Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasBool},
Ptr{Float64}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{Float64},
Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong), compq, whichq, strong, k, nc, kschur, n,
ni, s, select, t, ldt, ixt, q, ldq, ixq, m, tol, iwork,
dwork, ldwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return m[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (scale, info)
"""
function mb03ke!(trana::Bool, tranb::Bool, isgn::Integer, k::Integer,
m::Integer, n::Integer, prec::Number, smin::Number,
s::AbstractVector{BlasInt}, a::AbstractVector{Float64},
b::AbstractVector{Float64}, c::AbstractVector{Float64})
scale = Ref{Float64}()
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03ke_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{Float64}, Ref{Float64}, Ptr{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}), trana, tranb, isgn, k, m,
n, prec, smin, s, a, b, c, scale, dwork, ldwork, info)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return scale[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info)
"""
function mb03ld!(compq::AbstractChar, orth::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, de::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, fg::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, alphar::AbstractVector{Float64},
alphai::AbstractVector{Float64}, beta::AbstractVector{Float64},
liwork::Integer)
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
ldb = max(1,stride(b,2))
ldfg = max(1,stride(fg,2))
ldq = max(1,stride(q,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
bwork = Vector{BlasBool}(undef, n÷2)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03ld_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasBool},
Ptr{BlasInt}, Clong, Clong), compq, orth, n, a, lda, de,
ldde, b, ldb, fg, ldfg, neig, q, ldq, alphar, alphai,
beta, iwork, liwork, dwork, ldwork, bwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return neig[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info, iwarn)
"""
function mb03lf!(compq::AbstractChar, compu::AbstractChar,
orth::AbstractChar, n::Integer, z::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, fg::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, u::AbstractMatrix{Float64},
alphar::AbstractVector{Float64}, alphai::AbstractVector{Float64},
beta::AbstractVector{Float64}, liwork::Integer)
ldz = max(1,stride(z,2))
ldb = max(1,stride(b,2))
ldfg = max(1,stride(fg,2))
ldq = max(1,stride(q,2))
ldu = max(1,stride(u,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
bwork = Vector{BlasBool}(undef, n÷2)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03lf_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasBool}, Ptr{BlasInt}, Ptr{BlasInt}, Clong, Clong,
Clong), compq, compu, orth, n, z, ldz, b, ldb, fg, ldfg,
neig, q, ldq, u, ldu, alphar, alphai, beta, iwork,
liwork, dwork, ldwork, bwork, iwarn, info, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return neig[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info)
"""
function mb03lp!(compq::AbstractChar, orth::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, de::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, fg::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, alphar::AbstractVector{Float64},
alphai::AbstractVector{Float64}, beta::AbstractVector{Float64},
liwork::Integer)
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
ldb = max(1,stride(b,2))
ldfg = max(1,stride(fg,2))
ldq = max(1,stride(q,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
bwork = Vector{BlasBool}(undef, n÷2)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03lp_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasBool},
Ptr{BlasInt}, Clong, Clong), compq, orth, n, a, lda, de,
ldde, b, ldb, fg, ldfg, neig, q, ldq, alphar, alphai,
beta, iwork, liwork, dwork, ldwork, bwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return neig[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info)
"""
function mb03lz!(compq::AbstractChar, orth::AbstractChar, n::Integer,
a::AbstractMatrix{ComplexF64}, de::AbstractMatrix{ComplexF64},
b::AbstractMatrix{ComplexF64}, fg::AbstractMatrix{ComplexF64},
q::AbstractMatrix{ComplexF64}, alphar::AbstractVector{Float64},
alphai::AbstractVector{Float64}, beta::AbstractVector{Float64},
bwork::AbstractVector{BlasBool})
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
ldb = max(1,stride(b,2))
ldfg = max(1,stride(fg,2))
ldq = max(1,stride(q,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n+1)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
lzwork = BlasInt(-1)
zwork = Vector{ComplexF64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03lz_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{BlasBool}, Ptr{BlasInt}, Clong, Clong),
compq, orth, n, a, lda, de, ldde, b, ldb, fg, ldfg,
neig, q, ldq, alphar, alphai, beta, iwork, dwork,
ldwork, zwork, lzwork, bwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
lzwork = BlasInt(real(zwork[1]))
resize!(zwork, lzwork)
end
end
return neig[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (l, theta, info, iwarn)
"""
function mb03md!(n::Integer, ini_l::Integer, ini_theta::Number,
q::AbstractVector{Float64}, e::AbstractVector{Float64},
q2::AbstractVector{Float64}, e2::AbstractVector{Float64},
pivmin::Number, tol::Number, reltol::Number)
l = Ref{BlasInt}(ini_l)
theta = Ref{Float64}(ini_theta)
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
ccall((:mb03md_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ref{Float64}, Ref{Float64}, Ref{Float64},
Ptr{BlasInt}, Ptr{BlasInt}), n, l, theta, q, e, q2, e2,
pivmin, tol, reltol, iwarn, info)
chkargsok(info[])
return l[], theta[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb03my!(nx::Integer, x::AbstractVector{Float64},
incx::Integer)
jlres = ccall((:mb03my_, libslicot), Float64, (Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}), nx, x, incx)
return jlres
end
"""
$(TYPEDSIGNATURES)
returns (result, info)
"""
function mb03nd!(n::Integer, theta::Number,
q2::AbstractVector{Float64}, e2::AbstractVector{Float64},
pivmin::Number)
info = Ref{BlasInt}()
jlres = ccall((:mb03nd_, libslicot), BlasInt, (Ref{BlasInt},
Ref{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{Float64},
Ptr{BlasInt}), n, theta, q2, e2, pivmin, info)
chkargsok(info[])
return jlres, info[]
end
"""
$(TYPEDSIGNATURES)
returns (result, info)
"""
function mb03ny!(n::Integer, omega::Number,
a::AbstractMatrix{Float64},
s::AbstractVector{Float64}, ldwork::Integer, lcwork::Integer)
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
cwork = Vector{ComplexF64}(undef, lcwork)
jlres = ccall((:mb03ny_, libslicot), Float64, (Ref{BlasInt},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{BlasInt}), n, omega, a, lda, s, dwork,
ldwork, cwork, lcwork, info)
chkargsok(info[])
return jlres, info[]
end
"""
$(TYPEDSIGNATURES)
returns (rank, info)
"""
function mb03od!(jobqr::AbstractChar, m::Integer, n::Integer,
a::AbstractMatrix{Float64},
jpvt::AbstractVector{BlasInt}, rcond::Number, svlmax::Number,
tau::AbstractVector{Float64}, sval::AbstractVector{Float64})
lda = max(1,stride(a,2))
rank = Ref{BlasInt}()
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03od_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Ref{Float64}, Ref{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong), jobqr, m, n, a, lda, jpvt, rcond, svlmax, tau,
rank, sval, dwork, ldwork, info, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return rank[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (rank, info)
"""
function mb03oy!(m::Integer, n::Integer, a::AbstractMatrix{Float64},
rcond::Number, svlmax::Number,
sval::AbstractVector{Float64}, jpvt::AbstractVector{BlasInt},
tau::AbstractVector{Float64})
lda = max(1,stride(a,2))
rank = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, 3*n-1 )
ccall((:mb03oy_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{Float64}, Ref{Float64},
Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}), m, n, a, lda, rcond,
svlmax, rank, sval, jpvt, tau, dwork, info)
chkargsok(info[])
return rank[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (rank, info)
"""
function mb03pd!(jobrq::AbstractChar, m::Integer, n::Integer,
a::AbstractMatrix{Float64},
jpvt::AbstractVector{BlasInt}, rcond::Number, svlmax::Number,
tau::AbstractVector{Float64}, sval::AbstractVector{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
rank = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork )
ccall((:mb03pd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Ref{Float64}, Ref{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}, Clong), jobrq,
m, n, a, lda, jpvt, rcond, svlmax, tau, rank, sval,
dwork, info, 1)
chkargsok(info[])
return rank[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (rank, info)
"""
function mb03py!(m::Integer, n::Integer, a::AbstractMatrix{Float64},
rcond::Number, svlmax::Number,
sval::AbstractVector{Float64}, jpvt::AbstractVector{BlasInt},
tau::AbstractVector{Float64})
lda = max(1,stride(a,2))
rank = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, 3*m-1 )
ccall((:mb03py_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{Float64}, Ref{Float64},
Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}), m, n, a, lda, rcond,
svlmax, rank, sval, jpvt, tau, dwork, info)
chkargsok(info[])
return rank[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (ndim, info)
"""
function mb03qd!(dico::AbstractChar, stdom::AbstractChar,
jobu::AbstractChar, n::Integer, nlow::Integer, nsup::Integer,
alpha::Number, a::AbstractMatrix{Float64},
u::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldu = max(1,stride(u,2))
ndim = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, n)
ccall((:mb03qd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt},
Clong, Clong, Clong), dico, stdom, jobu, n, nlow, nsup,
alpha, a, lda, u, ldu, ndim, dwork, info, 1, 1, 1)
chkargsok(info[])
return ndim[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (ndim, info)
"""
function mb03qg!(dico::AbstractChar, stdom::AbstractChar,
jobu::AbstractChar, jobv::AbstractChar, n::Integer, nlow::Integer,
nsup::Integer, alpha::Number, a::AbstractMatrix{Float64},
e::AbstractMatrix{Float64}, u::AbstractMatrix{Float64},
v::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ldu = max(1,stride(u,2))
ldv = max(1,stride(v,2))
ndim = Ref{BlasInt}()
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03qg_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong, Clong, Clong),
dico, stdom, jobu, jobv, n, nlow, nsup, alpha, a, lda,
e, lde, u, ldu, v, ldv, ndim, dwork, ldwork, info, 1, 1,
1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return ndim[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03qv!(n::Integer, s::AbstractMatrix{Float64}, lds::Integer,
t::AbstractMatrix{Float64}, ldt::Integer,
alphar::AbstractVector{Float64}, alphai::AbstractVector{Float64},
beta::AbstractVector{Float64})
lds = max(1,stride(s,2))
ldt = max(1,stride(t,2))
info = Ref{BlasInt}()
ccall((:mb03qv_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}), n, s, lds, t,
ldt, alphar, alphai, beta, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03qw!(n::Integer, l::Integer, a::AbstractMatrix{Float64},
e::AbstractMatrix{Float64}, u::AbstractMatrix{Float64},
v::AbstractMatrix{Float64}, alphar::AbstractVector{Float64},
alphai::AbstractVector{Float64}, beta::AbstractVector{Float64})
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ldu = max(1,stride(u,2))
ldv = max(1,stride(v,2))
info = Ref{BlasInt}()
ccall((:mb03qw_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}),
n, l, a, lda, e, lde, u, ldu, v, ldv, alphar, alphai,
beta, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03qx!(n::Integer, t::AbstractMatrix{Float64},
wr::AbstractVector{Float64}, wi::AbstractVector{Float64})
ldt = max(1,stride(t,2))
info = Ref{BlasInt}()
ccall((:mb03qx_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}),
n, t, ldt, wr, wi, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03qy!(n::Integer, l::Integer, a::AbstractMatrix{Float64},
u::AbstractMatrix{Float64}, e1::Number, e2::Number)
lda = max(1,stride(a,2))
ldu = max(1,stride(u,2))
info = Ref{BlasInt}()
ccall((:mb03qy_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ref{Float64}, Ref{Float64}, Ptr{BlasInt}), n, l, a, lda,
u, ldu, e1, e2, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (nblcks, info)
"""
function mb03rd!(jobx::AbstractChar, sort::AbstractChar, n::Integer,
pmax::Number, a::AbstractMatrix{Float64},
x::AbstractMatrix{Float64}, blsize::AbstractVector{BlasInt},
wr::AbstractVector{Float64}, wi::AbstractVector{Float64},
tol::Number)
lda = max(1,stride(a,2))
ldx = max(1,stride(x,2))
nblcks = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, n)
ccall((:mb03rd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ref{Float64}, Ptr{Float64},
Ptr{BlasInt}, Clong, Clong), jobx, sort, n, pmax, a,
lda, x, ldx, nblcks, blsize, wr, wi, tol, dwork, info,
1, 1)
chkargsok(info[])
return nblcks[], info[]
end
"""
$(TYPEDSIGNATURES)
returns ku
"""
function mb03rx!(jobv::AbstractChar, n::Integer, kl::Integer,
ini_ku::Integer, a::AbstractMatrix{Float64},
x::AbstractMatrix{Float64}, wr::AbstractVector{Float64},
wi::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldx = max(1,stride(x,2))
ku = Ref{BlasInt}(ini_ku)
dwork = Vector{Float64}(undef, n)
ccall((:mb03rx_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Clong), jobv, n, kl, ku, a, lda, x, ldx,
wr, wi, dwork, 1)
return ku[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03ry!(m::Integer, n::Integer, pmax::Number,
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
c::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldc = max(1,stride(c,2))
info = Ref{BlasInt}()
ccall((:mb03ry_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}),
m, n, pmax, a, lda, b, ldb, c, ldc, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03sd!(jobscl::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, qg::AbstractMatrix{Float64},
wr::AbstractVector{Float64}, wi::AbstractVector{Float64},
ldwork::Integer)
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03sd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong), jobscl, n, a, lda, qg, ldqg, wr,
wi, dwork, ldwork, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (m, info)
"""
function mb03td!(typ::AbstractChar, compu::AbstractChar,
select::AbstractVector{BlasBool}, lower::AbstractVector{BlasBool},
n::Integer, a::AbstractMatrix{Float64},
g::AbstractMatrix{Float64}, u1::AbstractMatrix{Float64},
u2::AbstractMatrix{Float64}, wr::AbstractVector{Float64},
wi::AbstractVector{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldg = max(1,stride(g,2))
ldu1 = max(1,stride(u1,2))
ldu2 = max(1,stride(u2,2))
m = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03td_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ptr{BlasBool}, Ptr{BlasBool}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong, Clong), typ, compu, select, lower,
n, a, lda, g, ldg, u1, ldu1, u2, ldu2, wr, wi, m, dwork,
ldwork, info, 1, 1)
chkargsok(info[])
return m[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03ts!(isham::Bool, wantu::Bool, n::Integer,
a::AbstractMatrix{Float64}, g::AbstractMatrix{Float64},
u1::AbstractMatrix{Float64}, u2::AbstractMatrix{Float64},
j1::Integer, n1::Integer, n2::Integer)
lda = max(1,stride(a,2))
ldg = max(1,stride(g,2))
ldu1 = max(1,stride(u1,2))
ldu2 = max(1,stride(u2,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, n)
ccall((:mb03ts_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ptr{BlasInt}), isham, wantu, n, a, lda, g,
ldg, u1, ldu1, u2, ldu2, j1, n1, n2, dwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03ud!(jobq::AbstractChar, jobp::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, q::AbstractMatrix{Float64},
sv::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldq = max(1,stride(q,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03ud_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong, Clong), jobq, jobp, n, a, lda, q,
ldq, sv, dwork, ldwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03vd!(n::Integer, p::Integer, ilo::Integer, ihi::Integer,
a::Array{Float64,3}, tau::AbstractMatrix{Float64})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
ldtau = max(1,stride(tau,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, n)
ccall((:mb03vd_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{BlasInt}), n, p, ilo, ihi, a, lda1, lda2, tau,
ldtau, dwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03vy!(n::Integer, p::Integer, ilo::Integer, ihi::Integer,
a::Array{Float64,3}, tau::AbstractMatrix{Float64})
lda1 = max(1,stride(a,2))
lda2 = max(1,stride(a,3)÷lda1)
ldtau = max(1,stride(tau,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03vy_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}), n, p, ilo, ihi, a, lda1,
lda2, tau, ldtau, dwork, ldwork, info)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03wa!(wantq::Bool, wantz::Bool, n1::Integer, n2::Integer,
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, z::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldq = max(1,stride(q,2))
ldz = max(1,stride(z,2))
info = Ref{BlasInt}()
ccall((:mb03wa_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}), wantq, wantz,
n1, n2, a, lda, b, ldb, q, ldq, z, ldz, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03wd!(job::AbstractChar, compz::AbstractChar, n::Integer,
p::Integer, ilo::Integer, ihi::Integer, iloz::Integer,
ihiz::Integer, h::Array{Float64,3}, z::Array{Float64,3},
wr::AbstractVector{Float64}, wi::AbstractVector{Float64},
ldwork::Integer)
ldh1 = max(1,stride(h,2))
ldh2 = max(1,stride(h,3)÷ldh1)
ldz1 = max(1,stride(z,2))
ldz2 = max(1,stride(z,3)÷ldz1)
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03wd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong, Clong), job, compz, n, p, ilo, ihi,
iloz, ihiz, h, ldh1, ldh2, z, ldz1, ldz2, wr, wi, dwork,
ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03wx!(n::Integer, p::Integer, t::Array{Float64,3},
wr::AbstractVector{Float64}, wi::AbstractVector{Float64})
ldt1 = max(1,stride(t,2))
ldt2 = max(1,stride(t,3)÷ldt1)
info = Ref{BlasInt}()
ccall((:mb03wx_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}), n, p, t, ldt1, ldt2, wr,
wi, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (ilo, info)
"""
function mb03xd!(balanc::AbstractChar, job::AbstractChar,
jobu::AbstractChar, jobv::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, qg::AbstractMatrix{Float64},
t::AbstractMatrix{Float64}, u1::AbstractMatrix{Float64},
u2::AbstractMatrix{Float64}, v1::AbstractMatrix{Float64},
v2::AbstractMatrix{Float64}, wr::AbstractVector{Float64},
wi::AbstractVector{Float64}, scale::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
ldt = max(1,stride(t,2))
ldu1 = max(1,stride(u1,2))
ldu2 = max(1,stride(u2,2))
ldv1 = max(1,stride(v1,2))
ldv2 = max(1,stride(v2,2))
ilo = Ref{BlasInt}()
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03xd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong, Clong, Clong), balanc, job, jobu, jobv, n,
a, lda, qg, ldqg, t, ldt, u1, ldu1, u2, ldu2, v1, ldv1,
v2, ldv2, wr, wi, ilo, scale, dwork, ldwork, info, 1, 1,
1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return ilo[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03xp!(job::AbstractChar, compq::AbstractChar,
compz::AbstractChar, n::Integer, ilo::Integer, ihi::Integer,
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, z::AbstractMatrix{Float64},
alphar::AbstractVector{Float64}, alphai::AbstractVector{Float64},
beta::AbstractVector{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldq = max(1,stride(q,2))
ldz = max(1,stride(z,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03xp_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong, Clong), job,
compq, compz, n, ilo, ihi, a, lda, b, ldb, q, ldq, z,
ldz, alphar, alphai, beta, dwork, ldwork, info, 1, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03xs!(jobu::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, qg::AbstractMatrix{Float64},
u1::AbstractMatrix{Float64}, u2::AbstractMatrix{Float64},
wr::AbstractVector{Float64}, wi::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
ldu1 = max(1,stride(u1,2))
ldu2 = max(1,stride(u2,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03xs_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong), jobu, n, a, lda, qg, ldqg, u1,
ldu1, u2, ldu2, wr, wi, dwork, ldwork, info, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb03xu!(ltra::Bool, ltrb::Bool, n::Integer, k::Integer,
nb::Integer, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, g::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, xa::AbstractMatrix{Float64},
xb::AbstractMatrix{Float64}, xg::AbstractMatrix{Float64},
xq::AbstractMatrix{Float64}, ya::AbstractMatrix{Float64},
yb::AbstractMatrix{Float64}, yg::AbstractMatrix{Float64},
yq::AbstractMatrix{Float64}, csl::AbstractVector{Float64},
csr::AbstractVector{Float64}, taul::AbstractVector{Float64},
taur::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldg = max(1,stride(g,2))
ldq = max(1,stride(q,2))
ldxa = max(1,stride(xa,2))
ldxb = max(1,stride(xb,2))
ldxg = max(1,stride(xg,2))
ldxq = max(1,stride(xq,2))
ldya = max(1,stride(ya,2))
ldyb = max(1,stride(yb,2))
ldyg = max(1,stride(yg,2))
ldyq = max(1,stride(yq,2))
dwork = Vector{Float64}(undef, 5*nb)
ccall((:mb03xu_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64}),
ltra, ltrb, n, k, nb, a, lda, b, ldb, g, ldg, q, ldq,
xa, ldxa, xb, ldxb, xg, ldxg, xq, ldxq, ya, ldya, yb,
ldyb, yg, ldyg, yq, ldyq, csl, csr, taul, taur, dwork)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns (ilo, info)
"""
function mb03xz!(balanc::AbstractChar, job::AbstractChar,
jobu::AbstractChar, n::Integer, a::AbstractMatrix{ComplexF64},
qg::AbstractMatrix{ComplexF64}, u1::AbstractMatrix{ComplexF64},
u2::AbstractMatrix{ComplexF64}, wr::AbstractVector{Float64},
wi::AbstractVector{Float64}, scale::AbstractVector{Float64},
bwork::AbstractVector{BlasBool})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
ldu1 = max(1,stride(u1,2))
ldu2 = max(1,stride(u2,2))
ilo = Ref{BlasInt}()
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
lzwork = BlasInt(-1)
zwork = Vector{ComplexF64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03xz_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{BlasBool}, Ptr{BlasInt}, Clong, Clong,
Clong), balanc, job, jobu, n, a, lda, qg, ldqg, u1,
ldu1, u2, ldu2, wr, wi, ilo, scale, dwork, ldwork,
zwork, lzwork, bwork, info, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
lzwork = BlasInt(real(zwork[1]))
resize!(zwork, lzwork)
end
end
return ilo[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03ya!(wantt::Bool, wantq::Bool, wantz::Bool, n::Integer,
ilo::Integer, ihi::Integer, iloq::Integer, ihiq::Integer,
pos::Integer, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, q::AbstractMatrix{Float64},
z::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldq = max(1,stride(q,2))
ldz = max(1,stride(z,2))
info = Ref{BlasInt}()
ccall((:mb03ya_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasBool}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}),
wantt, wantq, wantz, n, ilo, ihi, iloq, ihiq, pos, a,
lda, b, ldb, q, ldq, z, ldz, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb03yd!(wantt::Bool, wantq::Bool, wantz::Bool, n::Integer,
ilo::Integer, ihi::Integer, iloq::Integer, ihiq::Integer,
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, z::AbstractMatrix{Float64},
alphar::AbstractVector{Float64}, alphai::AbstractVector{Float64},
beta::AbstractVector{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldq = max(1,stride(q,2))
ldz = max(1,stride(z,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03yd_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasBool}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}),
wantt, wantq, wantz, n, ilo, ihi, iloq, ihiq, a, lda, b,
ldb, q, ldq, z, ldz, alphar, alphai, beta, dwork,
ldwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (csl, snl, csr, snr)
"""
function mb03yt!(a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, alphar::AbstractVector{Float64},
alphai::AbstractVector{Float64}, beta::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
csl = Ref{Float64}()
snl = Ref{Float64}()
csr = Ref{Float64}()
snr = Ref{Float64}()
ccall((:mb03yt_, libslicot), Cvoid, (Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}), a, lda, b, ldb, alphar, alphai, beta,
csl, snl, csr, snr)
return csl[], snl[], csr[], snr[]
end
"""
$(TYPEDSIGNATURES)
returns (m, info)
"""
function mb03za!(compc::AbstractChar, compu::AbstractChar,
compv::AbstractChar, compw::AbstractChar, which::AbstractChar,
select::AbstractVector{BlasBool}, n::Integer,
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
c::AbstractMatrix{Float64}, u1::AbstractMatrix{Float64},
u2::AbstractMatrix{Float64}, v1::AbstractMatrix{Float64},
v2::AbstractMatrix{Float64}, w::AbstractMatrix{Float64},
wr::AbstractVector{Float64}, wi::AbstractVector{Float64},
ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldc = max(1,stride(c,2))
ldu1 = max(1,stride(u1,2))
ldu2 = max(1,stride(u2,2))
ldv1 = max(1,stride(v1,2))
ldv2 = max(1,stride(v2,2))
ldw = max(1,stride(w,2))
m = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb03za_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, Ptr{BlasBool},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong,
Clong, Clong, Clong), compc, compu, compv, compw, which,
select, n, a, lda, b, ldb, c, ldc, u1, ldu1, u2, ldu2,
v1, ldv1, v2, ldv2, w, ldw, wr, wi, m, dwork, ldwork,
info, 1, 1, 1, 1, 1)
chkargsok(info[])
return m[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (m, info)
"""
function mb03zd!(which::AbstractChar, meth::AbstractChar,
stab::AbstractChar, balanc::AbstractChar, ortbal::AbstractChar,
select::AbstractVector{BlasBool}, n::Integer, mm::Integer,
ilo::Integer, scale::AbstractVector{Float64},
s::AbstractMatrix{Float64}, t::AbstractMatrix{Float64},
g::AbstractMatrix{Float64}, u1::AbstractMatrix{Float64},
u2::AbstractMatrix{Float64}, v1::AbstractMatrix{Float64},
v2::AbstractMatrix{Float64},
wr::AbstractVector{Float64}, wi::AbstractVector{Float64},
us::AbstractMatrix{Float64}, uu::AbstractMatrix{Float64},
iwork::AbstractVector{BlasInt})
lds = max(1,stride(s,2))
ldt = max(1,stride(t,2))
ldg = max(1,stride(g,2))
ldu1 = max(1,stride(u1,2))
ldu2 = max(1,stride(u2,2))
ldv1 = max(1,stride(v1,2))
ldv2 = max(1,stride(v2,2))
ldus = max(1,stride(us,2))
lduu = max(1,stride(uu,2))
m = Ref{BlasInt}()
info = Ref{BlasInt}()
lwork = Vector{BlasBool}(undef, 2*n)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb03zd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, Ptr{BlasBool},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasBool}, Ptr{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong, Clong, Clong,
Clong), which, meth, stab, balanc, ortbal, select, n,
mm, ilo, scale, s, lds, t, ldt, g, ldg, u1, ldu1, u2,
ldu2, v1, ldv1, v2, ldv2, m, wr, wi, us, ldus, uu, lduu,
lwork, iwork, dwork, ldwork, info, 1, 1, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return m[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04ad!(job::AbstractChar, compq1::AbstractChar,
compq2::AbstractChar, compu1::AbstractChar, compu2::AbstractChar,
n::Integer, z::AbstractMatrix{Float64},
h::AbstractMatrix{Float64}, q1::AbstractMatrix{Float64},
q2::AbstractMatrix{Float64}, u11::AbstractMatrix{Float64},
u12::AbstractMatrix{Float64}, u21::AbstractMatrix{Float64},
u22::AbstractMatrix{Float64}, t::AbstractMatrix{Float64},
alphar::AbstractVector{Float64}, alphai::AbstractVector{Float64},
beta::AbstractVector{Float64}, liwork::Integer)
ldz = max(1,stride(z,2))
ldh = max(1,stride(h,2))
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
ldu11 = max(1,stride(u11,2))
ldu12 = max(1,stride(u12,2))
ldu21 = max(1,stride(u21,2))
ldu22 = max(1,stride(u22,2))
ldt = max(1,stride(t,2))
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04ad_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong, Clong, Clong,
Clong), job, compq1, compq2, compu1, compu2, n, z, ldz,
h, ldh, q1, ldq1, q2, ldq2, u11, ldu11, u12, ldu12, u21,
ldu21, u22, ldu22, t, ldt, alphar, alphai, beta, iwork,
liwork, dwork, ldwork, info, 1, 1, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04az!(job::AbstractChar, compq::AbstractChar,
compu::AbstractChar, n::Integer, z::AbstractMatrix{ComplexF64},
b::AbstractMatrix{ComplexF64}, fg::AbstractMatrix{ComplexF64},
d::AbstractMatrix{ComplexF64}, c::AbstractMatrix{ComplexF64},
q::AbstractMatrix{ComplexF64}, u::AbstractMatrix{ComplexF64},
alphar::AbstractVector{Float64}, alphai::AbstractVector{Float64},
beta::AbstractVector{Float64}, liwork::Integer,
bwork::AbstractVector{BlasBool})
ldz = max(1,stride(z,2))
ldb = max(1,stride(b,2))
ldfg = max(1,stride(fg,2))
ldd = max(1,stride(d,2))
ldc = max(1,stride(c,2))
ldq = max(1,stride(q,2))
ldu = max(1,stride(u,2))
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
lzwork = BlasInt(-1)
zwork = Vector{ComplexF64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04az_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{BlasBool}, Ptr{BlasInt},
Clong, Clong, Clong), job, compq, compu, n, z, ldz, b,
ldb, fg, ldfg, d, ldd, c, ldc, q, ldq, u, ldu, alphar,
alphai, beta, iwork, liwork, dwork, ldwork, zwork,
lzwork, bwork, info, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
lzwork = BlasInt(real(zwork[1]))
resize!(zwork, lzwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04bd!(job::AbstractChar, compq1::AbstractChar,
compq2::AbstractChar, n::Integer, a::AbstractMatrix{Float64},
de::AbstractMatrix{Float64}, c1::AbstractMatrix{Float64},
vw::AbstractMatrix{Float64}, q1::AbstractMatrix{Float64},
q2::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
f::AbstractMatrix{Float64}, c2::AbstractMatrix{Float64},
alphar::AbstractVector{Float64}, alphai::AbstractVector{Float64},
beta::AbstractVector{Float64}, liwork::Integer, ldwork::Integer)
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
ldc1 = max(1,stride(c1,2))
ldvw = max(1,stride(vw,2))
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
ldb = max(1,stride(b,2))
ldf = max(1,stride(f,2))
ldc2 = max(1,stride(c2,2))
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb04bd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong, Clong), job, compq1, compq2, n, a, lda,
de, ldde, c1, ldc1, vw, ldvw, q1, ldq1, q2, ldq2, b,
ldb, f, ldf, c2, ldc2, alphar, alphai, beta, iwork,
liwork, dwork, ldwork, info, 1, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (info, iwarn)
"""
function mb04bp!(job::AbstractChar, compq1::AbstractChar,
compq2::AbstractChar, n::Integer, a::AbstractMatrix{Float64},
de::AbstractMatrix{Float64}, c1::AbstractMatrix{Float64},
vw::AbstractMatrix{Float64}, q1::AbstractMatrix{Float64},
q2::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
f::AbstractMatrix{Float64}, c2::AbstractMatrix{Float64},
alphar::AbstractVector{Float64}, alphai::AbstractVector{Float64},
beta::AbstractVector{Float64}, liwork::Integer, ldwork::Integer)
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
ldc1 = max(1,stride(c1,2))
ldvw = max(1,stride(vw,2))
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
ldb = max(1,stride(b,2))
ldf = max(1,stride(f,2))
ldc2 = max(1,stride(c2,2))
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb04bp_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong, Clong), job, compq1, compq2, n, a, lda,
de, ldde, c1, ldc1, vw, ldvw, q1, ldq1, q2, ldq2, b,
ldb, f, ldf, c2, ldc2, alphar, alphai, beta, iwork,
liwork, dwork, ldwork, info, 1, 1, 1)
chkargsok(info[])
return info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04bz!(job::AbstractChar, compq::AbstractChar, n::Integer,
a::AbstractMatrix{ComplexF64}, de::AbstractMatrix{ComplexF64},
b::AbstractMatrix{ComplexF64}, fg::AbstractMatrix{ComplexF64},
q::AbstractMatrix{ComplexF64}, alphar::AbstractVector{Float64},
alphai::AbstractVector{Float64}, beta::AbstractVector{Float64},
bwork::AbstractVector{BlasBool})
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
ldb = max(1,stride(b,2))
ldfg = max(1,stride(fg,2))
ldq = max(1,stride(q,2))
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, 2*n+4)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
lzwork = BlasInt(-1)
zwork = Vector{ComplexF64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04bz_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt}, Ptr{BlasBool},
Ptr{BlasInt}, Clong, Clong), job, compq, n, a, lda, de,
ldde, b, ldb, fg, ldfg, q, ldq, alphar, alphai, beta,
iwork, dwork, ldwork, zwork, lzwork, bwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
lzwork = BlasInt(real(zwork[1]))
resize!(zwork, lzwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04cd!(compq1::AbstractChar, compq2::AbstractChar,
compq3::AbstractChar, n::Integer, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, d::AbstractMatrix{Float64},
q1::AbstractMatrix{Float64}, q2::AbstractMatrix{Float64},
q3::AbstractMatrix{Float64}, liwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldd = max(1,stride(d,2))
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
ldq3 = max(1,stride(q3,2))
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
bwork = Vector{BlasBool}(undef, n÷2)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04cd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasBool}, Ptr{BlasInt},
Clong, Clong, Clong), compq1, compq2, compq3, n, a, lda,
b, ldb, d, ldd, q1, ldq1, q2, ldq2, q3, ldq3, iwork,
liwork, dwork, ldwork, bwork, info, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04db!(job::AbstractChar, sgn::AbstractChar, n::Integer,
ilo::Integer, lscale::AbstractVector{Float64},
rscale::AbstractVector{Float64}, m::Integer,
v1::AbstractMatrix{Float64}, v2::AbstractMatrix{Float64})
ldv1 = max(1,stride(v1,2))
ldv2 = max(1,stride(v2,2))
info = Ref{BlasInt}()
ccall((:mb04db_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), job, sgn, n,
ilo, lscale, rscale, m, v1, ldv1, v2, ldv2, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (ilo, info)
"""
function mb04dd!(job::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, qg::AbstractMatrix{Float64},
scale::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
ilo = Ref{BlasInt}()
info = Ref{BlasInt}()
ccall((:mb04dd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt}, Clong), job,
n, a, lda, qg, ldqg, ilo, scale, info, 1)
chkargsok(info[])
return ilo[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04di!(job::AbstractChar, sgn::AbstractChar, n::Integer,
ilo::Integer, scale::AbstractVector{Float64}, m::Integer,
v1::AbstractMatrix{Float64}, v2::AbstractMatrix{Float64})
ldv1 = max(1,stride(v1,2))
ldv2 = max(1,stride(v2,2))
info = Ref{BlasInt}()
ccall((:mb04di_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong, Clong), job, sgn, n, ilo, scale, m,
v1, ldv1, v2, ldv2, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (ilo, ihi, info, iwarn)
"""
function mb04dl!(job::AbstractChar, n::Integer, thresh::Number,
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
lscale::AbstractVector{Float64}, rscale::AbstractVector{Float64},
dwork::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ilo = Ref{BlasInt}()
ihi = Ref{BlasInt}()
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
ccall((:mb04dl_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}, Ptr{BlasInt},
Clong), job, n, thresh, a, lda, b, ldb, ilo, ihi,
lscale, rscale, dwork, iwarn, info, 1)
chkargsok(info[])
return ilo[], ihi[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns (ilo, info, iwarn)
"""
function mb04dp!(job::AbstractChar, n::Integer, thresh::Number,
a::AbstractMatrix{Float64}, de::AbstractMatrix{Float64},
c::AbstractMatrix{Float64}, vw::AbstractMatrix{Float64},
lscale::AbstractVector{Float64}, rscale::AbstractVector{Float64},
dwork::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
ldc = max(1,stride(c,2))
ldvw = max(1,stride(vw,2))
ilo = Ref{BlasInt}()
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
ccall((:mb04dp_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}, Ptr{BlasInt}, Clong), job,
n, thresh, a, lda, de, ldde, c, ldc, vw, ldvw, ilo,
lscale, rscale, dwork, iwarn, info, 1)
chkargsok(info[])
return ilo[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns (ilo, info)
"""
function mb04ds!(job::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, qg::AbstractMatrix{Float64},
scale::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
ilo = Ref{BlasInt}()
info = Ref{BlasInt}()
ccall((:mb04ds_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt}, Clong), job,
n, a, lda, qg, ldqg, ilo, scale, info, 1)
chkargsok(info[])
return ilo[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04dy!(jobscl::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, qg::AbstractMatrix{Float64},
d::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, n)
ccall((:mb04dy_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}, Clong),
jobscl, n, a, lda, qg, ldqg, d, dwork, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (ilo, info)
"""
function mb04dz!(job::AbstractChar, n::Integer,
a::AbstractMatrix{ComplexF64}, qg::AbstractMatrix{ComplexF64},
scale::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
ilo = Ref{BlasInt}()
info = Ref{BlasInt}()
ccall((:mb04dz_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt},
Clong), job, n, a, lda, qg, ldqg, ilo, scale, info, 1)
chkargsok(info[])
return ilo[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04ed!(job::AbstractChar, compq::AbstractChar,
compu::AbstractChar, n::Integer, z::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, fg::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, u1::AbstractMatrix{Float64},
u2::AbstractMatrix{Float64}, alphar::AbstractVector{Float64},
alphai::AbstractVector{Float64}, beta::AbstractVector{Float64},
liwork::Integer)
ldz = max(1,stride(z,2))
ldb = max(1,stride(b,2))
ldfg = max(1,stride(fg,2))
ldq = max(1,stride(q,2))
ldu1 = max(1,stride(u1,2))
ldu2 = max(1,stride(u2,2))
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04ed_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong, Clong), job,
compq, compu, n, z, ldz, b, ldb, fg, ldfg, q, ldq, u1,
ldu1, u2, ldu2, alphar, alphai, beta, iwork, liwork,
dwork, ldwork, info, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04fd!(job::AbstractChar, compq::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, de::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, fg::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, alphar::AbstractVector{Float64},
alphai::AbstractVector{Float64}, beta::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
ldb = max(1,stride(b,2))
ldfg = max(1,stride(fg,2))
ldq = max(1,stride(q,2))
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n÷2+1)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04fd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), job, compq,
n, a, lda, de, ldde, b, ldb, fg, ldfg, q, ldq, alphar,
alphai, beta, iwork, dwork, ldwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04fp!(job::AbstractChar, compq::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, de::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, fg::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, alphar::AbstractVector{Float64},
alphai::AbstractVector{Float64}, beta::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
ldb = max(1,stride(b,2))
ldfg = max(1,stride(fg,2))
ldq = max(1,stride(q,2))
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n÷2+1)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04fp_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong), job, compq,
n, a, lda, de, ldde, b, ldb, fg, ldfg, q, ldq, alphar,
alphai, beta, iwork, dwork, ldwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04gd!(m::Integer, n::Integer, a::AbstractMatrix{Float64},
jpvt::AbstractVector{BlasInt}, tau::AbstractVector{Float64})
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, 3*m)
ccall((:mb04gd_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}), m, n, a, lda, jpvt, tau,
dwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04hd!(compq1::AbstractChar, compq2::AbstractChar,
n::Integer, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, q1::AbstractMatrix{Float64},
q2::AbstractMatrix{Float64}, liwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, liwork)
bwork = Vector{BlasBool}(undef, n÷2)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04hd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasBool}, Ptr{BlasInt}, Clong, Clong),
compq1, compq2, n, a, lda, b, ldb, q1, ldq1, q2, ldq2,
iwork, liwork, dwork, ldwork, bwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04id!(n::Integer, m::Integer, p::Integer, l::Integer,
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
tau::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04id_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}), n, m, p, l, a, lda, b, ldb,
tau, dwork, ldwork, info)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04iy!(side::AbstractChar, trans::AbstractChar, n::Integer,
m::Integer, k::Integer, p::Integer, a::AbstractMatrix{Float64},
tau::AbstractVector{Float64}, c::AbstractMatrix{Float64},
ldwork::Integer)
lda = max(1,stride(a,2))
ldc = max(1,stride(c,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb04iy_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong), side, trans, n, m, k, p, a, lda, tau, c,
ldc, dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04iz!(n::Integer, m::Integer, p::Integer, l::Integer,
a::AbstractMatrix{ComplexF64}, b::AbstractMatrix{ComplexF64},
tau::AbstractVector{ComplexF64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
lzwork = BlasInt(-1)
zwork = Vector{ComplexF64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04iz_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{BlasInt}), n, m, p, l, a, lda, b, ldb, tau, zwork,
lzwork, info)
chkargsok(info[])
if iwq == 1
lzwork = BlasInt(real(zwork[1]))
resize!(zwork, lzwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04jd!(n::Integer, m::Integer, p::Integer, l::Integer,
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
tau::AbstractVector{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb04jd_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}), n, m, p, l, a, lda, b, ldb,
tau, dwork, ldwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb04kd!(uplo::AbstractChar, n::Integer, m::Integer,
p::Integer, r::AbstractMatrix{Float64},
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
c::AbstractMatrix{Float64}, tau::AbstractVector{Float64})
ldr = max(1,stride(r,2))
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldc = max(1,stride(c,2))
dwork = Vector{Float64}(undef, n)
ccall((:mb04kd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Clong), uplo, n, m, p, r, ldr, a, lda, b, ldb, c, ldc,
tau, dwork, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb04ld!(uplo::AbstractChar, n::Integer, m::Integer,
p::Integer, l::AbstractMatrix{Float64},
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
c::AbstractMatrix{Float64}, tau::AbstractVector{Float64})
ldl = max(1,stride(l,2))
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldc = max(1,stride(c,2))
dwork = Vector{Float64}(undef, n)
ccall((:mb04ld_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Clong), uplo, n, m, p, l, ldl, a, lda, b, ldb, c, ldc,
tau, dwork, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns (maxred, info)
"""
function mb04md!(n::Integer, ini_maxred::Number,
a::AbstractMatrix{Float64}, scale::AbstractVector{Float64})
lda = max(1,stride(a,2))
maxred = Ref{Float64}(ini_maxred)
info = Ref{BlasInt}()
ccall((:mb04md_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{BlasInt}),
n, maxred, a, lda, scale, info)
chkargsok(info[])
return maxred[], info[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb04nd!(uplo::AbstractChar, n::Integer, m::Integer,
p::Integer, r::AbstractMatrix{Float64},
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
c::AbstractMatrix{Float64}, tau::AbstractVector{Float64})
ldr = max(1,stride(r,2))
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldc = max(1,stride(c,2))
dwork = Vector{Float64}(undef, max(n-1,m))
ccall((:mb04nd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Clong), uplo, n, m, p, r, ldr, a, lda, b, ldb, c, ldc,
tau, dwork, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb04ny!(m::Integer, n::Integer, v::AbstractVector{Float64},
incv::Integer, tau::Number, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
dwork = Vector{Float64}(undef, m)
ccall((:mb04ny_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}),
m, n, v, incv, tau, a, lda, b, ldb, dwork)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb04od!(uplo::AbstractChar, n::Integer, m::Integer,
p::Integer, r::AbstractMatrix{Float64},
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
c::AbstractMatrix{Float64}, tau::AbstractVector{Float64})
ldr = max(1,stride(r,2))
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldc = max(1,stride(c,2))
dwork = Vector{Float64}(undef, max(n-1,m))
ccall((:mb04od_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Clong), uplo, n, m, p, r, ldr, a, lda, b, ldb, c, ldc,
tau, dwork, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb04ow!(m::Integer, n::Integer, p::Integer,
a::AbstractMatrix{Float64}, t::AbstractMatrix{Float64},
x::AbstractVector{Float64}, incx::Integer,
b::AbstractMatrix{Float64}, c::AbstractMatrix{Float64},
d::AbstractVector{Float64}, incd::Integer)
lda = max(1,stride(a,2))
ldt = max(1,stride(t,2))
ldb = max(1,stride(b,2))
ldc = max(1,stride(c,2))
ccall((:mb04ow_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}), m, n, p, a, lda, t, ldt, x, incx, b, ldb,
c, ldc, d, incd)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb04ox!(n::Integer, a::AbstractMatrix{Float64},
x::AbstractVector{Float64}, incx::Integer)
lda = max(1,stride(a,2))
ccall((:mb04ox_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}), n, a, lda, x,
incx)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb04oy!(m::Integer, n::Integer, v::AbstractVector{Float64},
tau::Number, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
dwork = Vector{Float64}(undef, n)
ccall((:mb04oy_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}), m, n, v, tau,
a, lda, b, ldb, dwork)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb04pa!(lham::Bool, n::Integer, k::Integer, nb::Integer,
a::AbstractMatrix{Float64}, qg::AbstractMatrix{Float64},
xa::AbstractMatrix{Float64}, xg::AbstractMatrix{Float64},
xq::AbstractMatrix{Float64}, ya::AbstractMatrix{Float64},
cs::AbstractVector{Float64}, tau::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
ldxa = max(1,stride(xa,2))
ldxg = max(1,stride(xg,2))
ldxq = max(1,stride(xq,2))
ldya = max(1,stride(ya,2))
dwork = Vector{Float64}(undef, 3*nb)
ccall((:mb04pa_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}), lham, n, k, nb, a, lda, qg, ldqg, xa,
ldxa, xg, ldxg, xq, ldxq, ya, ldya, cs, tau, dwork)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04pb!(n::Integer, ilo::Integer, a::AbstractMatrix{Float64},
qg::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
tau::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04pb_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}), n, ilo, a, lda, qg, ldqg, cs, tau, dwork,
ldwork, info)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04pu!(n::Integer, ilo::Integer, a::AbstractMatrix{Float64},
qg::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
tau::AbstractVector{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb04pu_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}), n, ilo, a, lda, qg, ldqg, cs, tau, dwork,
ldwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb04py!(side::AbstractChar, m::Integer, n::Integer,
v::AbstractVector{Float64}, tau::Number,
c::AbstractMatrix{Float64}, dwork::AbstractVector{Float64})
ldc = max(1,stride(c,2))
ccall((:mb04py_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Clong), side, m, n, v, tau,
c, ldc, dwork, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04qb!(tranc::AbstractChar, trand::AbstractChar,
tranq::AbstractChar, storev::AbstractChar, storew::AbstractChar,
m::Integer, n::Integer, k::Integer, v::AbstractMatrix{Float64},
w::AbstractMatrix{Float64}, c::AbstractMatrix{Float64},
d::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
tau::AbstractVector{Float64})
ldv = max(1,stride(v,2))
ldw = max(1,stride(w,2))
ldc = max(1,stride(c,2))
ldd = max(1,stride(d,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04qb_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong,
Clong, Clong, Clong), tranc, trand, tranq, storev,
storew, m, n, k, v, ldv, w, ldw, c, ldc, d, ldd, cs,
tau, dwork, ldwork, info, 1, 1, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb04qc!(strab::AbstractChar, trana::AbstractChar,
tranb::AbstractChar, tranq::AbstractChar, direct::AbstractChar,
storev::AbstractChar, storew::AbstractChar, m::Integer,
n::Integer, k::Integer, v::AbstractMatrix{Float64},
w::AbstractMatrix{Float64}, rs::AbstractMatrix{Float64},
ldrs::Integer, t::AbstractMatrix{Float64},
a::AbstractMatrix{Float64}, b::AbstractMatrix{Float64},
dwork::AbstractVector{Float64})
ldv = max(1,stride(v,2))
ldw = max(1,stride(w,2))
ldt = max(1,stride(t,2))
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ccall((:mb04qc_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Clong, Clong, Clong, Clong, Clong, Clong,
Clong), strab, trana, tranb, tranq, direct, storev,
storew, m, n, k, v, ldv, w, ldw, rs, ldrs, t, ldt, a,
lda, b, ldb, dwork, 1, 1, 1, 1, 1, 1, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb04qf!(direct::AbstractChar, storev::AbstractChar,
storew::AbstractChar, n::Integer, k::Integer,
v::AbstractMatrix{Float64}, w::AbstractMatrix{Float64},
cs::AbstractVector{Float64}, tau::AbstractVector{Float64},
rs::AbstractMatrix{Float64}, t::AbstractMatrix{Float64})
ldv = max(1,stride(v,2))
ldw = max(1,stride(w,2))
ldrs = max(1,stride(rs,2))
ldt = max(1,stride(t,2))
dwork = Vector{Float64}(undef, 3*k)
ccall((:mb04qf_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Clong, Clong, Clong),
direct, storev, storew, n, k, v, ldv, w, ldw, cs, tau,
rs, ldrs, t, ldt, dwork, 1, 1, 1)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04qs!(tranc::AbstractChar, trand::AbstractChar,
tranu::AbstractChar, m::Integer, n::Integer, ilo::Integer,
v::AbstractMatrix{Float64}, w::AbstractMatrix{Float64},
c::AbstractMatrix{Float64}, d::AbstractMatrix{Float64},
cs::AbstractVector{Float64}, tau::AbstractVector{Float64})
ldv = max(1,stride(v,2))
ldw = max(1,stride(w,2))
ldc = max(1,stride(c,2))
ldd = max(1,stride(d,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04qs_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong, Clong, Clong), tranc, trand, tranu,
m, n, ilo, v, ldv, w, ldw, c, ldc, d, ldd, cs, tau,
dwork, ldwork, info, 1, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04qu!(tranc::AbstractChar, trand::AbstractChar,
tranq::AbstractChar, storev::AbstractChar, storew::AbstractChar,
m::Integer, n::Integer, k::Integer, v::AbstractMatrix{Float64},
w::AbstractMatrix{Float64}, c::AbstractMatrix{Float64},
d::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
tau::AbstractVector{Float64}, ldwork::Integer)
ldv = max(1,stride(v,2))
ldw = max(1,stride(w,2))
ldc = max(1,stride(c,2))
ldd = max(1,stride(d,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb04qu_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong,
Clong, Clong, Clong), tranc, trand, tranq, storev,
storew, m, n, k, v, ldv, w, ldw, c, ldc, d, ldd, cs,
tau, dwork, ldwork, info, 1, 1, 1, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04rb!(n::Integer, ilo::Integer, a::AbstractMatrix{Float64},
qg::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
tau::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04rb_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}), n, ilo, a, lda, qg, ldqg, cs, tau, dwork,
ldwork, info)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04ru!(n::Integer, ilo::Integer, a::AbstractMatrix{Float64},
qg::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
tau::AbstractVector{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb04ru_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}), n, ilo, a, lda, qg, ldqg, cs, tau, dwork,
ldwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04su!(m::Integer, n::Integer, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
tau::AbstractVector{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb04su_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}), m, n, a, lda, b, ldb, cs, tau, dwork,
ldwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04tb!(trana::AbstractChar, tranb::AbstractChar, n::Integer,
ilo::Integer, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, g::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, csl::AbstractVector{Float64},
csr::AbstractVector{Float64}, taul::AbstractVector{Float64},
taur::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldg = max(1,stride(g,2))
ldq = max(1,stride(q,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04tb_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong, Clong), trana, tranb, n, ilo, a,
lda, b, ldb, g, ldg, q, ldq, csl, csr, taul, taur,
dwork, ldwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04ts!(trana::AbstractChar, tranb::AbstractChar, n::Integer,
ilo::Integer, a::AbstractMatrix{Float64},
b::AbstractMatrix{Float64}, g::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, csl::AbstractVector{Float64},
csr::AbstractVector{Float64}, taul::AbstractVector{Float64},
taur::AbstractVector{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ldg = max(1,stride(g,2))
ldq = max(1,stride(q,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb04ts_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong, Clong), trana, tranb, n, ilo, a,
lda, b, ldb, g, ldg, q, ldq, csl, csr, taul, taur,
dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns rank
"""
function mb04tt!(updatq::Bool, updatz::Bool, m::Integer, n::Integer,
ifira::Integer, ifica::Integer, nca::Integer,
a::AbstractMatrix{Float64}, e::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, z::AbstractMatrix{Float64},
istair::AbstractVector{BlasInt}, tol::Number)
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ldq = max(1,stride(q,2))
ldz = max(1,stride(z,2))
rank = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n)
ccall((:mb04tt_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{Float64},
Ptr{BlasInt}), updatq, updatz, m, n, ifira, ifica, nca,
a, lda, e, lde, q, ldq, z, ldz, istair, rank, tol,
iwork)
return rank[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb04tu!(n::Integer, x::AbstractVector{Float64},
incx::Integer, y::AbstractVector{Float64}, incy::Integer,
c::Number, s::Number)
ccall((:mb04tu_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ref{Float64},
Ref{Float64}), n, x, incx, y, incy, c, s)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb04tv!(updatz::Bool, n::Integer, nra::Integer, nca::Integer,
ifira::Integer, ifica::Integer, a::AbstractMatrix{Float64},
e::AbstractMatrix{Float64}, z::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ldz = max(1,stride(z,2))
ccall((:mb04tv_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}), updatz, n, nra, nca, ifira,
ifica, a, lda, e, lde, z, ldz)
return nothing
end
"""
$(TYPEDSIGNATURES)
"""
function mb04tw!(updatq::Bool, m::Integer, n::Integer, nre::Integer,
nce::Integer, ifire::Integer, ifice::Integer, ifica::Integer,
a::AbstractMatrix{Float64}, e::AbstractMatrix{Float64},
q::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ldq = max(1,stride(q,2))
ccall((:mb04tw_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}),
updatq, m, n, nre, nce, ifire, ifice, ifica, a, lda, e,
lde, q, ldq)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns nblcks
"""
function mb04tx!(updatq::Bool, updatz::Bool, m::Integer, n::Integer,
ini_nblcks::Integer, inuk::AbstractVector{BlasInt},
imuk::AbstractVector{BlasInt}, a::AbstractMatrix{Float64},
e::AbstractMatrix{Float64}, q::AbstractMatrix{Float64},
z::AbstractMatrix{Float64}, mnei::AbstractVector{BlasInt})
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ldq = max(1,stride(q,2))
ldz = max(1,stride(z,2))
nblcks = Ref{BlasInt}(ini_nblcks)
ccall((:mb04tx_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasInt}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}), updatq, updatz, m, n,
nblcks, inuk, imuk, a, lda, e, lde, q, ldq, z, ldz,
mnei)
return nblcks[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04ty!(updatq::Bool, updatz::Bool, m::Integer, n::Integer,
nblcks::Integer, inuk::AbstractVector{BlasInt},
imuk::AbstractVector{BlasInt}, a::AbstractMatrix{Float64},
e::AbstractMatrix{Float64}, q::AbstractMatrix{Float64},
z::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ldq = max(1,stride(q,2))
ldz = max(1,stride(z,2))
info = Ref{BlasInt}()
ccall((:mb04ty_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}), updatq, updatz, m, n,
nblcks, inuk, imuk, a, lda, e, lde, q, ldq, z, ldz,
info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (ranke, info)
"""
function mb04ud!(jobq::AbstractChar, jobz::AbstractChar, m::Integer,
n::Integer, a::AbstractMatrix{Float64},
e::AbstractMatrix{Float64}, q::AbstractMatrix{Float64},
z::AbstractMatrix{Float64}, istair::AbstractVector{BlasInt},
tol::Number)
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ldq = max(1,stride(q,2))
ldz = max(1,stride(z,2))
ranke = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, max(m,n))
ccall((:mb04ud_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt},
Ref{Float64}, Ptr{Float64}, Ptr{BlasInt}, Clong, Clong),
jobq, jobz, m, n, a, lda, e, lde, q, ldq, z, ldz, ranke,
istair, tol, dwork, info, 1, 1)
chkargsok(info[])
return ranke[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (nblcks, nblcki, info)
"""
function mb04vd!(mode::AbstractChar, jobq::AbstractChar,
jobz::AbstractChar, m::Integer, n::Integer, ranke::Integer,
a::AbstractMatrix{Float64}, e::AbstractMatrix{Float64},
q::AbstractMatrix{Float64}, z::AbstractMatrix{Float64},
istair::AbstractVector{BlasInt}, imuk::AbstractVector{BlasInt},
inuk::AbstractVector{BlasInt}, imuk0::AbstractVector{BlasInt},
mnei::AbstractVector{BlasInt}, tol::Number)
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ldq = max(1,stride(q,2))
ldz = max(1,stride(z,2))
nblcks = Ref{BlasInt}()
nblcki = Ref{BlasInt}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n)
ccall((:mb04vd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ref{Float64},
Ptr{BlasInt}, Ptr{BlasInt}, Clong, Clong, Clong), mode,
jobq, jobz, m, n, ranke, a, lda, e, lde, q, ldq, z, ldz,
istair, nblcks, nblcki, imuk, inuk, imuk0, mnei, tol,
iwork, info, 1, 1, 1)
chkargsok(info[])
return nblcks[], nblcki[], info[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb04vx!(updatq::Bool, updatz::Bool, m::Integer, n::Integer,
nblcks::Integer, inuk::AbstractVector{BlasInt},
imuk::AbstractVector{BlasInt}, a::AbstractMatrix{Float64},
e::AbstractMatrix{Float64}, q::AbstractMatrix{Float64},
z::AbstractMatrix{Float64}, mnei::AbstractVector{BlasInt})
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ldq = max(1,stride(q,2))
ldz = max(1,stride(z,2))
ccall((:mb04vx_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}), updatq, updatz, m, n,
nblcks, inuk, imuk, a, lda, e, lde, q, ldq, z, ldz,
mnei)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04wd!(tranq1::AbstractChar, tranq2::AbstractChar,
m::Integer, n::Integer, k::Integer, q1::AbstractMatrix{Float64},
q2::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
tau::AbstractVector{Float64})
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04wd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong), tranq1, tranq2, m, n, k, q1, ldq1, q2,
ldq2, cs, tau, dwork, ldwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04wp!(n::Integer, ilo::Integer,
u1::AbstractMatrix{Float64}, u2::AbstractMatrix{Float64},
cs::AbstractVector{Float64}, tau::AbstractVector{Float64})
ldu1 = max(1,stride(u1,2))
ldu2 = max(1,stride(u2,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04wp_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}), n, ilo, u1, ldu1, u2, ldu2, cs, tau,
dwork, ldwork, info)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04wr!(job::AbstractChar, trans::AbstractChar, n::Integer,
ilo::Integer, q1::AbstractMatrix{Float64},
q2::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
tau::AbstractVector{Float64})
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04wr_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong, Clong),
job, trans, n, ilo, q1, ldq1, q2, ldq2, cs, tau, dwork,
ldwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04wu!(tranq1::AbstractChar, tranq2::AbstractChar,
m::Integer, n::Integer, k::Integer, q1::AbstractMatrix{Float64},
q2::AbstractMatrix{Float64}, cs::AbstractVector{Float64},
tau::AbstractVector{Float64}, ldwork::Integer)
ldq1 = max(1,stride(q1,2))
ldq2 = max(1,stride(q2,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb04wu_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong, Clong), tranq1, tranq2, m, n, k, q1, ldq1, q2,
ldq2, cs, tau, dwork, ldwork, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (rank, theta, info, iwarn)
"""
function mb04xd!(jobu::AbstractChar, jobv::AbstractChar, m::Integer,
n::Integer, ini_rank::Integer, ini_theta::Number,
a::AbstractMatrix{Float64}, u::AbstractMatrix{Float64},
v::AbstractMatrix{Float64}, q::AbstractVector{Float64},
inul::AbstractVector{BlasBool}, tol::Number, reltol::Number)
lda = max(1,stride(a,2))
ldu = max(1,stride(u,2))
ldv = max(1,stride(v,2))
rank = Ref{BlasInt}(ini_rank)
theta = Ref{Float64}(ini_theta)
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb04xd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{BlasBool},
Ref{Float64}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Clong, Clong), jobu, jobv,
m, n, rank, theta, a, lda, u, ldu, v, ldv, q, inul, tol,
reltol, dwork, ldwork, iwarn, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return rank[], theta[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04xy!(jobu::AbstractChar, jobv::AbstractChar, m::Integer,
n::Integer, x::AbstractMatrix{Float64},
taup::AbstractVector{Float64}, tauq::AbstractVector{Float64},
u::AbstractMatrix{Float64}, v::AbstractMatrix{Float64},
inul::AbstractVector{BlasBool})
ldx = max(1,stride(x,2))
ldu = max(1,stride(u,2))
ldv = max(1,stride(v,2))
info = Ref{BlasInt}()
ccall((:mb04xy_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasBool}, Ptr{BlasInt},
Clong, Clong), jobu, jobv, m, n, x, ldx, taup, tauq, u,
ldu, v, ldv, inul, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (rank, theta, info, iwarn)
"""
function mb04yd!(jobu::AbstractChar, jobv::AbstractChar, m::Integer,
n::Integer, ini_rank::Integer, ini_theta::Number,
q::AbstractVector{Float64}, e::AbstractVector{Float64},
u::AbstractMatrix{Float64}, v::AbstractMatrix{Float64},
inul::AbstractVector{BlasBool}, tol::Number, reltol::Number,
ldwork::Integer)
ldu = max(1,stride(u,2))
ldv = max(1,stride(v,2))
rank = Ref{BlasInt}(ini_rank)
theta = Ref{Float64}(ini_theta)
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb04yd_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasBool}, Ref{Float64},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}, Clong, Clong), jobu, jobv, m, n, rank,
theta, q, e, u, ldu, v, ldv, inul, tol, reltol, dwork,
ldwork, iwarn, info, 1, 1)
chkargsok(info[])
return rank[], theta[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
"""
function mb04yw!(qrit::Bool, updatu::Bool, updatv::Bool, m::Integer,
n::Integer, l::Integer, k::Integer, shift::Number,
d::AbstractVector{Float64}, e::AbstractVector{Float64},
u::AbstractMatrix{Float64}, v::AbstractMatrix{Float64})
ldu = max(1,stride(u,2))
ldv = max(1,stride(v,2))
dwork = Vector{Float64}(undef, max(1,ldwork))
ccall((:mb04yw_, libslicot), Cvoid, (Ref{BlasBool}, Ref{BlasBool},
Ref{BlasBool}, Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}), qrit, updatu, updatv, m, n, l, k, shift,
d, e, u, ldu, v, ldv, dwork)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb04zd!(compu::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, qg::AbstractMatrix{Float64},
u::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldqg = max(1,stride(qg,2))
ldu = max(1,stride(u,2))
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, 2*n)
ccall((:mb04zd_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{BlasInt},
Clong), compu, n, a, lda, qg, ldqg, u, ldu, dwork, info,
1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb05md!(balanc::AbstractChar, n::Integer, delta::Number,
a::AbstractMatrix{Float64}, v::AbstractMatrix{Float64},
y::AbstractMatrix{Float64}, valr::AbstractVector{Float64},
vali::AbstractVector{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
ldv = max(1,stride(v,2))
ldy = max(1,stride(y,2))
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n)
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb05md_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Clong), balanc, n, delta, a, lda, v, ldv,
y, ldy, valr, vali, iwork, dwork, ldwork, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb05my!(balanc::AbstractChar, n::Integer,
a::AbstractMatrix{Float64}, wr::AbstractVector{Float64},
wi::AbstractVector{Float64}, r::AbstractMatrix{Float64},
q::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
ldr = max(1,stride(r,2))
ldq = max(1,stride(q,2))
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb05my_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Clong),
balanc, n, a, lda, wr, wi, r, ldr, q, ldq, dwork,
ldwork, info, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb05nd!(n::Integer, delta::Number,
a::AbstractMatrix{Float64}, ex::AbstractMatrix{Float64},
exint::AbstractMatrix{Float64}, tol::Number,
ldwork::Integer)
lda = max(1,stride(a,2))
ldex = max(1,stride(ex,2))
ldexin = max(1,stride(exint,2))
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n)
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb05nd_, libslicot), Cvoid, (Ref{BlasInt}, Ref{Float64},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{Float64}, Ptr{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}), n, delta, a,
lda, ex, ldex, exint, ldexin, tol, iwork, dwork, ldwork,
info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (mdig, idig, info, iwarn)
"""
function mb05od!(balanc::AbstractChar, n::Integer, ndiag::Integer,
delta::Number, a::AbstractMatrix{Float64}, ldwork::Integer)
lda = max(1,stride(a,2))
mdig = Ref{BlasInt}()
idig = Ref{BlasInt}()
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n)
dwork = Vector{Float64}(undef, ldwork)
ccall((:mb05od_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Clong),
balanc, n, ndiag, delta, a, lda, mdig, idig, iwork,
dwork, ldwork, iwarn, info, 1)
chkargsok(info[])
return mdig[], idig[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb05oy!(job::AbstractChar, n::Integer, low::Integer,
igh::Integer, a::AbstractMatrix{Float64},
scale::AbstractVector{Float64})
lda = max(1,stride(a,2))
info = Ref{BlasInt}()
ccall((:mb05oy_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{BlasInt}, Clong), job, n, low, igh, a,
lda, scale, info, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info)
"""
function mb3jzp!(compq::AbstractChar, n::Integer,
a::AbstractMatrix{ComplexF64}, d::AbstractMatrix{ComplexF64},
b::AbstractMatrix{ComplexF64}, f::AbstractMatrix{ComplexF64},
q::AbstractMatrix{ComplexF64}, tol::Number)
lda = max(1,stride(a,2))
ldd = max(1,stride(d,2))
ldb = max(1,stride(b,2))
ldf = max(1,stride(f,2))
ldq = max(1,stride(q,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, n÷2)
zwork = Vector{ComplexF64}(undef, n÷2)
ccall((:mb3jzp_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{BlasInt}, Ref{Float64}, Ptr{Float64},
Ptr{ComplexF64}, Ptr{BlasInt}, Clong), compq, n, a, lda,
d, ldd, b, ldb, f, ldf, q, ldq, neig, tol, dwork, zwork,
info, 1)
chkargsok(info[])
return neig[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (neig, info)
"""
function mb3lzp!(compq::AbstractChar, orth::AbstractChar, n::Integer,
a::AbstractMatrix{ComplexF64}, de::AbstractMatrix{ComplexF64},
b::AbstractMatrix{ComplexF64}, fg::AbstractMatrix{ComplexF64},
q::AbstractMatrix{ComplexF64}, alphar::AbstractVector{Float64},
alphai::AbstractVector{Float64}, beta::AbstractVector{Float64},
bwork::AbstractVector{BlasBool})
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
ldb = max(1,stride(b,2))
ldfg = max(1,stride(fg,2))
ldq = max(1,stride(q,2))
neig = Ref{BlasInt}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, n+1)
ldwork = BlasInt(-1)
dwork = Vector{Float64}(undef, 1)
lzwork = BlasInt(-1)
zwork = Vector{ComplexF64}(undef, 1)
local jlres
for iwq in 1:2
ccall((:mb3lzp_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{BlasBool}, Ptr{BlasInt}, Clong, Clong),
compq, orth, n, a, lda, de, ldde, b, ldb, fg, ldfg,
neig, q, ldq, alphar, alphai, beta, iwork, dwork,
ldwork, zwork, lzwork, bwork, info, 1, 1)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
lzwork = BlasInt(real(zwork[1]))
resize!(zwork, lzwork)
end
end
return neig[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (rank, info)
"""
function mb3oyz!(m::Integer, n::Integer,
a::AbstractMatrix{ComplexF64}, rcond::Number,
svlmax::Number, sval::AbstractVector{Float64},
jpvt::AbstractVector{BlasInt}, tau::AbstractVector{ComplexF64})
lda = max(1,stride(a,2))
rank = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, 2*n )
zwork = Vector{ComplexF64}(undef, 3*n-1 )
ccall((:mb3oyz_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ref{Float64},
Ref{Float64}, Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt},
Ptr{ComplexF64}, Ptr{Float64}, Ptr{ComplexF64},
Ptr{BlasInt}), m, n, a, lda, rcond, svlmax, rank, sval,
jpvt, tau, dwork, zwork, info)
chkargsok(info[])
return rank[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (rank, info)
"""
function mb3pyz!(m::Integer, n::Integer,
a::AbstractMatrix{ComplexF64}, rcond::Number,
svlmax::Number, sval::AbstractVector{Float64},
jpvt::AbstractVector{BlasInt}, tau::AbstractVector{ComplexF64})
lda = max(1,stride(a,2))
rank = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, 2*m )
zwork = Vector{ComplexF64}(undef, 3*m-1 )
ccall((:mb3pyz_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ref{Float64},
Ref{Float64}, Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt},
Ptr{ComplexF64}, Ptr{Float64}, Ptr{ComplexF64},
Ptr{BlasInt}), m, n, a, lda, rcond, svlmax, rank, sval,
jpvt, tau, dwork, zwork, info)
chkargsok(info[])
return rank[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mb4dbz!(job::AbstractChar, sgn::AbstractChar, n::Integer,
ilo::Integer, lscale::AbstractVector{Float64},
rscale::AbstractVector{Float64}, m::Integer,
v1::AbstractMatrix{ComplexF64}, v2::AbstractMatrix{ComplexF64})
ldv1 = max(1,stride(v1,2))
ldv2 = max(1,stride(v2,2))
info = Ref{BlasInt}()
ccall((:mb4dbz_, libslicot), Cvoid, (Ref{UInt8}, Ref{UInt8},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{BlasInt}, Clong,
Clong), job, sgn, n, ilo, lscale, rscale, m, v1, ldv1,
v2, ldv2, info, 1, 1)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (ilo, ihi, info, iwarn)
"""
function mb4dlz!(job::AbstractChar, n::Integer, thresh::Number,
a::AbstractMatrix{ComplexF64}, b::AbstractMatrix{ComplexF64},
lscale::AbstractVector{Float64}, rscale::AbstractVector{Float64},
dwork::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldb = max(1,stride(b,2))
ilo = Ref{BlasInt}()
ihi = Ref{BlasInt}()
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
ccall((:mb4dlz_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{Float64}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{BlasInt}, Ptr{BlasInt}, Clong), job, n, thresh, a,
lda, b, ldb, ilo, ihi, lscale, rscale, dwork, iwarn,
info, 1)
chkargsok(info[])
return ilo[], ihi[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns (ilo, info, iwarn)
"""
function mb4dpz!(job::AbstractChar, n::Integer, thresh::Number,
a::AbstractMatrix{ComplexF64}, de::AbstractMatrix{ComplexF64},
c::AbstractMatrix{ComplexF64}, vw::AbstractMatrix{ComplexF64},
lscale::AbstractVector{Float64}, rscale::AbstractVector{Float64},
dwork::AbstractVector{Float64})
lda = max(1,stride(a,2))
ldde = max(1,stride(de,2))
ldc = max(1,stride(c,2))
ldvw = max(1,stride(vw,2))
ilo = Ref{BlasInt}()
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
ccall((:mb4dpz_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ref{Float64}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{ComplexF64}, Ref{BlasInt}, Ptr{ComplexF64},
Ref{BlasInt}, Ptr{ComplexF64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{BlasInt}, Ptr{BlasInt}, Clong), job, n, thresh, a,
lda, de, ldde, c, ldc, vw, ldvw, ilo, lscale, rscale,
dwork, iwarn, info, 1)
chkargsok(info[])
return ilo[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mc01md!(dp::Integer, alpha::Number, k::Integer,
p::AbstractVector{Float64}, q::AbstractVector{Float64})
info = Ref{BlasInt}()
ccall((:mc01md_, libslicot), Cvoid, (Ref{BlasInt}, Ref{Float64},
Ref{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}),
dp, alpha, k, p, q, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (vr, vi, info)
"""
function mc01nd!(dp::Integer, xr::Number, xi::Number,
p::AbstractVector{Float64})
vr = Ref{Float64}()
vi = Ref{Float64}()
info = Ref{BlasInt}()
ccall((:mc01nd_, libslicot), Cvoid, (Ref{BlasInt}, Ref{Float64},
Ref{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{BlasInt}), dp, xr, xi, p, vr, vi, info)
chkargsok(info[])
return vr[], vi[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mc01od!(k::Integer, rez::AbstractVector{Float64},
imz::AbstractVector{Float64}, rep::AbstractVector{Float64},
imp::AbstractVector{Float64})
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, 2*k+2)
ccall((:mc01od_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{BlasInt}), k, rez, imz, rep, imp, dwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mc01pd!(k::Integer, rez::AbstractVector{Float64},
imz::AbstractVector{Float64}, p::AbstractVector{Float64})
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, k+1)
ccall((:mc01pd_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}),
k, rez, imz, p, dwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mc01py!(k::Integer, rez::AbstractVector{Float64},
imz::AbstractVector{Float64}, p::AbstractVector{Float64})
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, k)
ccall((:mc01py_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}),
k, rez, imz, p, dwork, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (db, info, iwarn)
"""
function mc01qd!(da::Integer, ini_db::Integer,
a::AbstractVector{Float64}, b::AbstractVector{Float64},
rq::AbstractVector{Float64})
db = Ref{BlasInt}(ini_db)
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
ccall((:mc01qd_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ptr{BlasInt}), da, db, a, b, rq, iwarn, info)
chkargsok(info[])
return db[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns (dp3, info)
"""
function mc01rd!(dp1::Integer, dp2::Integer, ini_dp3::Integer,
alpha::Number, p1::AbstractVector{Float64},
p2::AbstractVector{Float64}, p3::AbstractVector{Float64})
dp3 = Ref{BlasInt}(ini_dp3)
info = Ref{BlasInt}()
ccall((:mc01rd_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ptr{BlasInt}, Ref{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}), dp1, dp2, dp3, alpha, p1,
p2, p3, info)
chkargsok(info[])
return dp3[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (s, t, info)
"""
function mc01sd!(dp::Integer, p::AbstractVector{Float64},
mant::AbstractVector{Float64}, e::AbstractVector{BlasInt})
s = Ref{BlasInt}()
t = Ref{BlasInt}()
info = Ref{BlasInt}()
iwork = Vector{BlasInt}(undef, dp+1)
ccall((:mc01sd_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{Float64}, Ptr{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}), dp, p, s, t, mant, e,
iwork, info)
chkargsok(info[])
return s[], t[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (m, e)
"""
function mc01sw!(a::Number, b::Integer)
m = Ref{Float64}()
e = Ref{BlasInt}()
ccall((:mc01sw_, libslicot), Cvoid, (Ref{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{BlasInt}), a, b, m, e)
return m[], e[]
end
"""
$(TYPEDSIGNATURES)
"""
function mc01sx!(lb::Integer, ub::Integer, e::AbstractVector{BlasInt},
mant::AbstractVector{Float64})
jlres = ccall((:mc01sx_, libslicot), BlasInt, (Ref{BlasInt},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64}), lb, ub, e,
mant)
return jlres
end
"""
$(TYPEDSIGNATURES)
returns (a, ovflow)
"""
function mc01sy!(m::Number, e::Integer, b::Integer)
a = Ref{Float64}()
ovflow = Ref{BlasBool}()
ccall((:mc01sy_, libslicot), Cvoid, (Ref{Float64}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ptr{BlasBool}), m, e, b, a,
ovflow)
return a[], ovflow[]
end
"""
$(TYPEDSIGNATURES)
returns (dp, stable, nz, info, iwarn)
"""
function mc01td!(dico::AbstractChar, ini_dp::Integer,
p::AbstractVector{Float64})
dp = Ref{BlasInt}(ini_dp)
stable = Ref{BlasBool}()
nz = Ref{BlasInt}()
info = Ref{BlasInt}()
iwarn = Ref{BlasInt}()
dwork = Vector{Float64}(undef, 2*ini_dp+2)
ccall((:mc01td_, libslicot), Cvoid, (Ref{UInt8}, Ptr{BlasInt},
Ptr{Float64}, Ptr{BlasBool}, Ptr{BlasInt}, Ptr{Float64},
Ptr{BlasInt}, Ptr{BlasInt}, Clong), dico, dp, p, stable,
nz, dwork, iwarn, info, 1)
chkargsok(info[])
return dp[], stable[], nz[], info[], iwarn[]
end
"""
$(TYPEDSIGNATURES)
returns (z1re, z1im, z2re, z2im, info)
"""
function mc01vd!(a::Number, b::Number, c::Number)
z1re = Ref{Float64}()
z1im = Ref{Float64}()
z2re = Ref{Float64}()
z2im = Ref{Float64}()
info = Ref{BlasInt}()
ccall((:mc01vd_, libslicot), Cvoid, (Ref{Float64}, Ref{Float64},
Ref{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{BlasInt}), a, b, c, z1re, z1im, z2re,
z2im, info)
chkargsok(info[])
return z1re[], z1im[], z2re[], z2im[], info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mc01wd!(dp::Integer, p::AbstractVector{Float64}, u1::Number,
u2::Number, q::AbstractVector{Float64})
info = Ref{BlasInt}()
ccall((:mc01wd_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{Float64},
Ref{Float64}, Ref{Float64}, Ptr{Float64}, Ptr{BlasInt}),
dp, p, u1, u2, q, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mc01xd!(alpha::Number, beta::Number, gamma::Number,
delta::Number, evr::AbstractVector{Float64},
evi::AbstractVector{Float64}, evq::AbstractVector{Float64})
info = Ref{BlasInt}()
ldwork = BlasInt(-1)
# some of this is used even in the workspace query
dwork = Vector{Float64}(undef, 64)
local jlres
for iwq in 1:2
ccall((:mc01xd_, libslicot), Cvoid, (Ref{Float64}, Ref{Float64},
Ref{Float64}, Ref{Float64}, Ptr{Float64}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}),
alpha, beta, gamma, delta, evr, evi, evq, dwork, ldwork,
info)
chkargsok(info[])
if iwq == 1
ldwork = BlasInt(real(dwork[1]))
resize!(dwork, ldwork)
end
end
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (dp3, info)
"""
function mc03md!(rp1::Integer, cp1::Integer, cp2::Integer,
dp1::Integer, dp2::Integer, ini_dp3::Integer, alpha::Number,
p1::Array{Float64,3}, p2::Array{Float64,3}, p3::Array{Float64,3})
ldp11 = max(1,stride(p1,2))
ldp12 = max(1,stride(p1,3)÷ldp11)
ldp21 = max(1,stride(p2,2))
ldp22 = max(1,stride(p2,3)÷ldp21)
ldp31 = max(1,stride(p3,2))
ldp32 = max(1,stride(p3,3)÷ldp31)
dp3 = Ref{BlasInt}(ini_dp3)
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, cp1)
ccall((:mc03md_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ref{BlasInt}, Ref{BlasInt}, Ptr{BlasInt},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ptr{BlasInt}),
rp1, cp1, cp2, dp1, dp2, dp3, alpha, p1, ldp11, ldp12,
p2, ldp21, ldp22, p3, ldp31, ldp32, dwork, info)
chkargsok(info[])
return dp3[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (dk, info)
"""
function mc03nd!(mp::Integer, np::Integer, dp::Integer,
p::Array{Float64,3},
gam::AbstractVector{BlasInt}, nullsp::AbstractMatrix{Float64},
ker::Array{Float64,3}, tol::Number, iwork::AbstractVector{BlasInt},
ldwork::Integer)
ldp1 = max(1,stride(p,2))
ldp2 = max(1,stride(p,3)÷ldp1)
ldnull = max(1,stride(nullsp,2))
ldker1 = max(1,stride(ker,2))
ldker2 = max(1,stride(ker,3)÷ldker1)
dk = Ref{BlasInt}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:mc03nd_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt}, Ref{Float64},
Ptr{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}),
mp, np, dp, p, ldp1, ldp2, dk, gam, nullsp, ldnull, ker,
ldker1, ldker2, tol, iwork, dwork, ldwork, info)
chkargsok(info[])
return dk[], info[]
end
"""
$(TYPEDSIGNATURES)
"""
function mc03nx!(mp::Integer, np::Integer, dp::Integer,
p::Array{Float64,3},
a::AbstractMatrix{Float64}, e::AbstractMatrix{Float64})
ldp1 = max(1,stride(p,2))
ldp2 = max(1,stride(p,3)÷ldp1)
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ccall((:mc03nx_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}),
mp, np, dp, p, ldp1, ldp2, a, lda, e, lde)
return nothing
end
"""
$(TYPEDSIGNATURES)
returns info
"""
function mc03ny!(nblcks::Integer, nra::Integer, nca::Integer,
a::AbstractMatrix{Float64}, e::AbstractMatrix{Float64},
imuk::AbstractVector{BlasInt}, inuk::AbstractVector{BlasInt},
veps::AbstractMatrix{Float64})
lda = max(1,stride(a,2))
lde = max(1,stride(e,2))
ldveps = max(1,stride(veps,2))
info = Ref{BlasInt}()
ccall((:mc03ny_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}), nblcks, nra, nca, a, lda,
e, lde, imuk, inuk, veps, ldveps, info)
chkargsok(info[])
return info[]
end
"""
$(TYPEDSIGNATURES)
returns (gnorm, info)
"""
function md03ba!(n::Integer, ipar::AbstractVector{BlasInt},
lipar::Integer, fnorm::Number, j::AbstractVector{Float64},
e::AbstractVector{Float64},
jnorms::AbstractVector{Float64}, ipvt::AbstractVector{BlasInt},
ldwork::Integer)
ldj = max(1,stride(j,2))
gnorm = Ref{Float64}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:md03ba_, libslicot), Cvoid, (Ref{BlasInt}, Ptr{BlasInt},
Ref{BlasInt}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}), n, ipar,
lipar, fnorm, j, ldj, e, jnorms, gnorm, ipvt, dwork,
ldwork, info)
chkargsok(info[])
return gnorm[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (par, info)
"""
function md03bb!(cond::AbstractChar, n::Integer,
ipar::AbstractVector{BlasInt}, lipar::Integer,
r::AbstractMatrix{Float64}, ipvt::AbstractVector{BlasInt},
diag::AbstractVector{Float64}, qtb::AbstractVector{Float64},
delta::Number, ini_par::Number, ranks::AbstractVector{BlasInt},
x::AbstractVector{Float64}, rx::AbstractVector{Float64},
tol::Number, ldwork::Integer)
ldr = max(1,stride(r,2))
par = Ref{Float64}(ini_par)
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:md03bb_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{BlasInt}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{BlasInt}, Ptr{Float64}, Ptr{Float64}, Ref{Float64},
Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64}, Ptr{Float64},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt},
Clong), cond, n, ipar, lipar, r, ldr, ipvt, diag, qtb,
delta, par, ranks, x, rx, tol, dwork, ldwork, info, 1)
chkargsok(info[])
return par[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (gnorm, info)
"""
function md03bx!(m::Integer, n::Integer, fnorm::Number,
j::AbstractVector{Float64},
e::AbstractVector{Float64}, jnorms::AbstractVector{Float64},
ipvt::AbstractVector{BlasInt}, ldwork::Integer)
ldj = max(1,stride(j,2))
gnorm = Ref{Float64}()
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:md03bx_, libslicot), Cvoid, (Ref{BlasInt}, Ref{BlasInt},
Ref{Float64}, Ptr{Float64}, Ref{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ptr{Float64}, Ptr{BlasInt}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}), m, n, fnorm, j, ldj, e,
jnorms, gnorm, ipvt, dwork, ldwork, info)
chkargsok(info[])
return gnorm[], info[]
end
"""
$(TYPEDSIGNATURES)
returns (par, info)
"""
function md03by!(cond::AbstractChar, n::Integer,
r::AbstractMatrix{Float64}, ipvt::AbstractVector{BlasInt},
diag::AbstractVector{Float64}, qtb::AbstractVector{Float64},
delta::Number, ini_par::Number, rank::Integer,
x::AbstractVector{Float64}, rx::AbstractVector{Float64},
tol::Number, ldwork::Integer)
ldr = max(1,stride(r,2))
par = Ref{Float64}(ini_par)
info = Ref{BlasInt}()
dwork = Vector{Float64}(undef, ldwork)
ccall((:md03by_, libslicot), Cvoid, (Ref{UInt8}, Ref{BlasInt},
Ptr{Float64}, Ref{BlasInt}, Ptr{BlasInt}, Ptr{Float64},
Ptr{Float64}, Ref{Float64}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}, Ptr{Float64}, Ref{Float64}, Ptr{Float64},
Ref{BlasInt}, Ptr{BlasInt}, Clong), cond, n, r, ldr,
ipvt, diag, qtb, delta, par, rank, x, rx, tol, dwork,
ldwork, info, 1)
chkargsok(info[])
return par[], info[]
end
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1331 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb01td(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
LDA = NMAX
LDB = NMAX
LDWORK = NMAX-1
A = Array{Float64,2}(undef, LDA,NMAX)
B = Array{Float64,2}(undef, LDB,NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
if ( N<0 || N>NMAX )
else
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
INFO = SLICOT.mb01td!(N, A, B)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
# interp output 1
println(io,"B:")
_nc = N
_nr = N
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2003 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02cd(datfile, io=stdout)
ZERO = 0.0e0
NIN = 5
NOUT = 6
KMAX = 20
NMAX = 20
LDG = 2*KMAX
LDL = NMAX*KMAX
LDR = NMAX*KMAX
LDT = KMAX
LDWORK = ( NMAX - 1 )*KMAX
LCS = 3*LDWORK
T = Array{Float64,2}(undef, LDT,NMAX*KMAX)
G = Array{Float64,2}(undef, LDG,NMAX*KMAX)
R = Array{Float64,2}(undef, LDR,NMAX*KMAX)
L = Array{Float64,2}(undef, LDL,NMAX*KMAX)
CS = Array{Float64,1}(undef, LCS)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
K = parse(BlasInt, vs[2])
JOB = vs[3][1]
TYPET = 'R'
M = N*K
if ( N<=0 || N>NMAX )
else
if ( K<=0 || K>KMAX )
else
vs = String[]
_isz,_jsz = (K,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
T[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
INFO = SLICOT.mb02cd!(JOB, TYPET, K, N, T, G, R, L, CS, LCS, LDWORK)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( LSAME( JOB, 'G' ) || LSAME( JOB, 'A' ) || LSAME( JOB, 'L' ) || LSAME( JOB, 'R' ) )
# interp call 2
#FOREIGN.dlaset!( 'Full', K, K, ZERO, ZERO, G(K+1,1), LDG )
G[K+1:2*K,1:K] .= ZERO
# interp output 1
println(io, "G:")
_nc = M
_nr = 2*K
show(io, "text/plain", G[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( JOB, 'L' ) || LSAME( JOB, 'A' ) )
# interp output 2
println(io, "L:")
_nc = M
_nr = M
show(io, "text/plain", L[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( JOB, 'R' ) || LSAME( JOB, 'A' ) || LSAME( JOB, 'O' ) )
# interp output 3
println(io, "R:")
_nc = M
_nr = M
show(io, "text/plain", R[1:_nr,1:_nc])
println(io)
end # if
end # if
end # if
end # if
close(f)
end # run_mb02cd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3954 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02dd(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 20
MMAX = 20
NMAX = 20
LDG = KMAX*( MMAX + NMAX )
LDL = KMAX*( MMAX + NMAX )
LDR = KMAX*( MMAX + NMAX )
LDT = KMAX*( MMAX + NMAX )
LDWORK = ( MMAX + NMAX - 1 )*KMAX
LCS = 3*LDWORK
tdim = KMAX*(MMAX+NMAX)
T = Array{Float64,2}(undef, LDT,KMAX*(MMAX+NMAX))
G = Array{Float64,2}(undef, LDG,KMAX*(MMAX+NMAX))
R = Array{Float64,2}(undef, LDR,KMAX*(MMAX+NMAX))
L = Array{Float64,2}(undef, LDL,KMAX*(MMAX+NMAX))
CS = Array{Float64,1}(undef, LCS)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
K = parse(BlasInt, vs[2])
M = parse(BlasInt, vs[3])
JOB = vs[4][1]
TYPET = vs[5][1]
S = ( N + M )*K
if ( N<=0 || N>NMAX )
else
if ( K<=0 || K>KMAX )
else
if ( M<=0 || M>MMAX )
else
if ( LSAME( TYPET, 'R' ) )
vs = String[]
_isz,_jsz = (K,S)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
T[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
else
vs = String[]
_isz,_jsz = (S,K)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
T[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end # if
# interp call 1
INFO = SLICOT.mb02cd!(JOB, TYPET, K, N, T, G, R, L, CS, LCS, LDWORK)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
# interp output 1
println(io, "R:")
_nc = N*K
_nr = N*K
show(io, "text/plain", R[1:_nr,1:_nc])
println(io)
if ( LSAME( JOB, 'R' ) || LSAME( JOB, 'A' ) )
if ( LSAME( TYPET, 'R' ) )
# interp output 2
println(io, "G:")
_nc = N*K
_nr = 2*K
show(io, "text/plain", G[1:_nr,1:_nc])
println(io)
else
# interp output 3
println(io, "G:")
_nc = 2*K
_nr = N*K
show(io, "text/plain", G[1:_nr,1:_nc])
println(io)
end # if
end # if
if ( LSAME( JOB, 'A' ) )
# interp output 4
println(io, "L:")
_nc = N*K
_nr = N*K
show(io, "text/plain", L[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( TYPET, 'R' ) )
# interp call 2
# FOREIGN.dlacpy!( 'All', N*K, K, R(1,(N-1)*K+1), LDR, R(K+1,N*K+1), LDR )
for ir in 1:N*K
for ic in 1:K
R[K+ir,N*K+ic] = R[ir,(N-1)*K+ic]
end
end
# interp call 3
INFO = SLICOT.mb02dd!(JOB, TYPET, K, M, N, view(T,1:K,N*K+1:tdim), T, G,
view(R,:,N*K+1:(N*M)*K), view(L,N*K+1:LDL,:), CS, LDWORK)
@test INFO == 0
INFO == 0 || return
else
# interp call 4
#FOREIGN.dlacpy!( 'All', K, N*K, R((N-1)*K+1,1), LDR, R(N*K+1,K+1), LDR )
for ir in 1:K
for ic in 1:N*K
R[N*K+ir,K+ic] = R[(N-1)*K+ir,ic]
end
end
# interp call 5
INFO = SLICOT.mb02dd!(JOB, TYPET, K, M, N, view(T,N*K+1:(N+M)*K,:), T, G, view(R,N*K+1:(N+M)*K,:), view(L,:, N*K+1:(N+M)*K), CS, LDWORK)
@test INFO == 0
INFO == 0 || return
end # if
if ( INFO!=0 )
else
# interp output 5
println(io, "R:")
_nc = S
_nr = S
show(io, "text/plain", R[1:_nr,1:_nc])
println(io)
if ( LSAME( JOB, 'R' ) || LSAME( JOB, 'A' ) )
if ( LSAME( TYPET, 'R' ) )
# interp output 6
println(io, "G:")
_nc = S
_nr = 2*K
show(io, "text/plain", G[1:_nr,1:_nc])
println(io)
else
# interp output 7
println(io, "G:")
_nc = 2*K
_nr = S
show(io, "text/plain", G[1:_nr,1:_nc])
println(io)
end # if
end # if
if ( LSAME( JOB, 'A' ) )
# interp output 8
println(io, "L:")
_nc = S
_nr = S
show(io, "text/plain", L[1:_nr,1:_nc])
println(io)
end # if
end # if
end # if
end # if
end # if
end # if
close(f)
end # run_mb02dd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2357 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02ed(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 20
NMAX = 20
LDB = KMAX*NMAX
LDT = KMAX*NMAX
LDWORK = NMAX*KMAX*KMAX + ( NMAX+2 )*KMAX
T = Array{Float64,2}(undef, LDT,KMAX*NMAX)
B = Array{Float64,2}(undef, LDB,KMAX*NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
K = parse(BlasInt, vs[2])
NRHS = parse(BlasInt, vs[3])
TYPET = vs[4][1]
M = N*K
if ( N<=0 || N>NMAX )
else
if ( K<=0 || K>KMAX )
else
if ( NRHS<=0 || NRHS>KMAX*NMAX )
else
if ( LSAME( TYPET, 'R' ) )
vs = String[]
_isz,_jsz = (K,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
T[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
else
vs = String[]
_isz,_jsz = (M,K)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
T[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end # if
if ( LSAME( TYPET, 'R' ) )
vs = String[]
_isz,_jsz = (NRHS,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
else
vs = String[]
_isz,_jsz = (M,NRHS)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end # if
# interp call 1
INFO = SLICOT.mb02ed!(TYPET, K, N, NRHS, T, B, LDWORK)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( LSAME( TYPET, 'R' ) )
# interp output 1
println(io,"B:")
_nc = M
_nr = NRHS
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
else
# interp output 2
println(io,"B:")
_nc = NRHS
_nr = M
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
end # if
end # if
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 7289 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02fd(datfile, io=stdout)
ZERO = 0.0e0
ONE = 1.0e0
NIN = 5
NOUT = 6
ITMAX = 10
KMAX = 20
NMAX = 20
LDR = NMAX*KMAX
LDT = KMAX
LDWORK = ( NMAX + 1 )*KMAX
S = Array{BlasInt,1}(undef, ITMAX)
tdim = NMAX*KMAX
#T = Array{Float64,2}(undef, LDT,NMAX*KMAX)
T = fill(zero(Float64), LDT,NMAX*KMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
#R = Array{Float64,2}(undef, LDR,NMAX*KMAX)
R = fill(zero(Float64),LDR,NMAX*KMAX)
V = Array{Float64,1}(undef, NMAX*KMAX)
W = Array{Float64,1}(undef, NMAX*KMAX)
Z = Array{Float64,1}(undef, NMAX*KMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
K = parse(BlasInt, vs[2])
IT = parse(BlasInt, vs[3])
TYPET = 'R'
M = N*K
local NNRM
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
elseif ( K<=0 || K>KMAX )
@error "Illegal K=$K"
elseif ( IT<=0 || IT>ITMAX )
@error "Illegal IT=$IT"
end
vs = String[]
_isz = IT
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
S[1:_isz] .= parsex.(BlasInt, vs)
vs = String[]
_isz,_jsz = (K,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
T[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
P = 0
POS = 1
for SCIT in 1:IT # do 90
# interp call 1
#Rtmp = R[POS:LDR,POS:tdim]
INFO = SLICOT.mb02fd!(TYPET, K, N, P, S[SCIT], view(T,1:LDT,POS:tdim),
view(R,POS:LDR,POS:tdim), LDWORK)
#R[POS:LDR,POS:tdim] .= Rtmp
@test INFO == 0
if ( INFO!=0 )
return
end # if
S1 = S[SCIT] + P
if ( S1==0 )
LEN = N*K
# interp call 2
#FOREIGN.dlaset!( 'All', LEN, 1, ONE, ONE, V, 1 )
V[1:LEN] .= ONE
# interp call 3
for PIT in 1:5 # do 30
for i in 1:N
#FOREIGN.dgemv!( 'NoTranspose', K, LEN-(I-1)*K, ONE, T, LDT, V((I-1)*K+1), 1, ZERO, W((I-1)*K+1), 1 )
#W[(i-1)*K+1:i*K] .= T[1:K,1:LEN-(i-1)*K] * V[(i-1)*K+1:LEN]
_nc = LEN-(i-1)*K
BLAS.gemv!('N',ONE,T[1:K,1:_nc],V[(i-1)*K+1:LEN],ZERO,view(W,(i-1)*K+1:i*K))
end
# interp call 4
for i in 1:N-1
#FOREIGN.dgemv!( 'Transpose', K, (N-I)*K, ONE, T(1,K+1), LDT, V((I-1)*K+1), 1, ONE, W(I*K+1), 1 )
#W[i*K+1:N*K] .= T[1:K,K+1:(N-i+1)*K]' * V[(i-1)*K+1:i*K]
BLAS.gemv!('T',ONE,T[1:K,K+1:(N-i+1)*K],V[(i-1)*K+1:i*K],ONE,view(W,i*K+1:N*K))
end
# interp call 5
#FOREIGN.dcopy!( LEN, W, 1, V, 1 )
V[1:LEN] .= W[1:LEN]
end # for PIT
#NNRM = DNRM2( LEN, V, 1 )
NNRM = norm(V[1:LEN])
# interp call 6
#FOREIGN.dscal!( LEN, ONE/NNRM, V, 1 )
V[1:LEN] .*= ONE / NNRM
else
LEN = ( N - S1 )*K
# interp call 7
#FOREIGN.dlaset!( 'All', LEN, 1, ONE, ONE, V, 1 )
V[1:LEN] .= ONE
for PIT in 1:5 # do 80
POSR = ( S1 - 1 )*K + 1
for i in 1:N-S1 # do 40
# interp call 8
#FOREIGN.dgemv!( 'NoTranspose', K, LEN-(I-1)*K, ONE, T(1,POSR+K), LDT, V((I-1)*K+1), 1, ZERO, W((I-1)*K+1), 1 )
_nc = LEN-(i-1)*K
#W[(i-1)*K+1:i*K] .= T[1:K,POSR+K:POSR+K+_nc-1] * V[(i-1)*K+1:LEN]
BLAS.gemv!('N',ONE,T[1:K,POSR+K:POSR+K+_nc-1],V[(i-1)*K+1:LEN],ZERO,
view(W,(i-1)*K+1:i*K))
end
for i in 1:N-S1 # do 50
# interp call 9
#FOREIGN.dtrmv!( 'U', 'N', 'N', K, R[POSR,POSR], LDR, V[(I-1)*K+1], 1 )
#V[(i-1)*K+1:i*K] .= UpperTriangular(R[POSR:POSR+K-1,POSR:POSR+K-1]) * V[(i-1)*K+1:i*K]
BLAS.trmv!('U','N','N',R[POSR:POSR+K-1,POSR:POSR+K-1],view(V,(i-1)*K+1:i*K))
# interp call 10
#FOREIGN.dgemv!( 'N', K, LEN-I*K, ONE, R[POSR,POSR+K], LDR, V[I*K+1], 1, ONE, V[(I-1)*K+1], 1 )
#V[(i-1)*K+1:i*K] .= R[POSR:POSR+K-1,POSR+K:POSR+K+LEN-i*K-1] * V[i*K+1:LEN]
BLAS.gemv!('N',ONE,R[POSR:POSR+K-1,POSR+K:POSR+K+LEN-i*K-1],
V[i*K+1:LEN],ONE,view(V,(i-1)*K+1:i*K))
end
# interp call 11
#FOREIGN.dlaset!( 'All', LEN, 1, ZERO, ZERO, Z, 1 )
Z[1:LEN] .= ZERO
for i in 1:N-S1 # do 60
# interp call 12
#FOREIGN.dgemv!( 'T', K, LEN-I*K, ONE, R[POSR,POSR+K], LDR, V[(I-1)*K+1], 1, ONE, Z[I*K+1], 1 )
#Z[i*K+1:LEN] .+= R[POSR:POSR+K-1,POSR:POSR+LEN-i*K-1]' * V[(i-1)*K+1:i*K]
BLAS.gemv!('T',ONE,R[POSR:POSR+K-1,POSR:POSR+LEN-i*K-1],V[(i-1)*K+1:i*K],
ONE,view(Z,i*K+1:LEN))
# interp call 13
#FOREIGN.dtrmv!( 'U', 'T', 'N', K, R[POSR,POSR], LDR, V[(I-1)*K+1], 1 )
#V[(i-1)*K+1:i*K] .= UpperTriangular(R[POSR:POSR+K-1,POSR:POSR+K-1])' * V[(i-1)*K+1:i*K]
BLAS.trmv!('U','T','N',R[POSR:POSR+K-1,POSR:POSR+K-1],
view(V,(i-1)*K+1:i*K))
# interp call 14
#FOREIGN.daxpy!( K, ONE, V((I-1)*K+1), 1, Z((I-1)*K+1), 1 )
Z[(i-1)*K+1:i*K] .+= V[(i-1)*K+1:i*K]
end
# interp call 15
# FOREIGN.dlaset!( 'All', LEN, 1, ZERO, ZERO, V, 1 )
V[1:LEN] .= ZERO
for i in 1:N-S1 # do 70
# interp call 16
#FOREIGN.dgemv!( 'T', K, LEN-(I-1)*K, ONE, T(1,POSR+K), LDT, W((I-1)*K+1), 1, ONE, V((I-1)*K+1), 1 )
#V[(i-1)*K+1:LEN] .+= T[1:K,POSR+K:POSR+K+LEN-(i-1)*K-1]' * W[(i-1)*K+1:i*K]
BLAS.gemv!('T',ONE,T[1:K,POSR+K:POSR+K+LEN-(i-1)*K-1],W[(i-1)*K+1:i*K],
ONE,view(V,(i-1)*K+1:LEN))
end
# interp call 17
#FOREIGN.daxpy!( LEN, -ONE, Z, 1, V, 1 )
#V[1:LEN] .-= Z[1:LEN]
BLAS.axpy!(-ONE,Z[1:LEN],view(V,1:LEN))
# NNRM = DNRM2( LEN, V, 1 )
NNRM = norm(V[1:LEN])
# interp call 18
# FOREIGN.dscal!( LEN, -ONE/NNRM, V, 1 )
V[1:LEN] .*= (-ONE / NNRM)
end # for / do 80
POS = ( S1 - 1 )*K + 1
P = S1
end # if
println(io, "rows: $(P*K); norm of Schur complement: $NNRM")
end # for / do 90
# interp output 1
println(io, "R:")
_nc = M
_nr = P*K
show(io, "text/plain", R[1:_nr,1:_nc])
println(io)
end # run_mb02fd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1471 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02gd(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 20
NMAX = 20
NLMAX = 20
LDRB = ( NLMAX + 1 )*KMAX
LDT = KMAX*NMAX
LDWORK = ( NLMAX + 1 )*KMAX*KMAX + ( 3 + NLMAX )*KMAX
T = Array{Float64,2}(undef, LDT,NMAX*KMAX)
RB = Array{Float64,2}(undef, LDRB,NMAX*KMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
K = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
NL = parse(BlasInt, vs[3])
TRIU = vs[4][1]
TYPET = 'R'
M = ( NL + 1 )*K
if ( N<=0 || N>NMAX )
elseif ( NL<=0 || NL>NLMAX )
elseif ( K<=0 || K>KMAX )
else
vs = String[]
_isz,_jsz = (K,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
T[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
INFO = SLICOT.mb02gd!(TYPET, TRIU, K, N, NL, 0, N, T, RB)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( LSAME( TRIU, 'T' ) )
SIZR = NL*K + 1
else
SIZR = ( NL + 1 )*K
end # if
# interp output 1
println(io,"RB:")
_nc = N*K
_nr = SIZR
show(io,"text/plain",RB[1:_nr,1:_nc])
println(io,)
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2046 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02hd(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 20
LMAX = 20
MMAX = 20
MLMAX = 10
NMAX = 20
NUMAX = 10
LDRB = ( MLMAX + NUMAX + 1 )*LMAX
LDTC = ( MLMAX + 1 )*KMAX
LDTR = KMAX
LDWORK = LDRB*LMAX + ( 2*NUMAX + 1 )*LMAX*KMAX + 2*LDRB*( KMAX + LMAX ) + LDRB + 6*LMAX
TC = Array{Float64,2}(undef, LDTC,LMAX)
TR = Array{Float64,2}(undef, LDTR,NMAX*LMAX)
RB = Array{Float64,2}(undef, LDRB,NMAX*LMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
K = parse(BlasInt, vs[1])
L = parse(BlasInt, vs[2])
M = parse(BlasInt, vs[3])
ML = parse(BlasInt, vs[4])
N = parse(BlasInt, vs[5])
NU = parse(BlasInt, vs[6])
TRIU = vs[7][1]
if ( K<0 || K>KMAX )
elseif ( L<0 || L>LMAX )
elseif ( M<=0 || M>MMAX )
elseif ( ML<0 || ML>MLMAX )
elseif ( N<=0 || N>NMAX )
elseif ( NU<0 || NU>NUMAX )
else
vs = String[]
_isz,_jsz = (ML*K+K,L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TC[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (K,NU*L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TR[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
S = (min(M*K,N*L)+L-1) ÷ L
# interp call 1
INFO = SLICOT.mb02hd!(TRIU, K, L, M, ML, N, NU, 0, S, TC, TR, RB)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
LENR = ( ML + NU + 1 )*L
LENR = min( LENR, N*L )
# interp output 1
println(io,"RB:")
_nc = min( N*L, M*K )
_nr = LENR
show(io,"text/plain",RB[1:_nr,1:_nc])
println(io,)
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2952 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02id(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 20
LMAX = 20
MMAX = 20
NMAX = 20
RBMAX = 20
RCMAX = 20
LDB = KMAX*MMAX
LDC = KMAX*MMAX
LDTC = MMAX*KMAX
LDTR = KMAX
LDWORK = 2*NMAX*LMAX*( LMAX + KMAX ) + ( 6 + NMAX )*LMAX + MMAX*KMAX*( LMAX + 1 ) + RBMAX + RCMAX
TC = Array{Float64,2}(undef, LDTC,LMAX)
TR = Array{Float64,2}(undef, LDTR,NMAX*LMAX)
B = Array{Float64,2}(undef, LDB,RBMAX)
C = Array{Float64,2}(undef, LDC,RCMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
K = parse(BlasInt, vs[1])
L = parse(BlasInt, vs[2])
M = parse(BlasInt, vs[3])
N = parse(BlasInt, vs[4])
RB = parse(BlasInt, vs[5])
RC = parse(BlasInt, vs[6])
JOB = vs[7][1]
if ( K<=0 || K>KMAX )
elseif ( L<=0 || L>LMAX )
elseif ( M<=0 || M>MMAX )
elseif ( N<=0 || N>NMAX )
elseif ( ( LSAME( JOB, 'O' ) || LSAME( JOB, 'A' ) ) && ( ( RB<=0 ) || ( RB>RBMAX ) ) )
elseif ( ( LSAME( JOB, 'U' ) || LSAME( JOB, 'A' ) ) && ( ( RC<=0 ) || ( RC>RCMAX ) ) )
else
vs = String[]
_isz,_jsz = (M*K,L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TC[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (K,N*L-L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TR[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
if ( LSAME( JOB, 'O' ) || LSAME( JOB, 'A' ) )
vs = String[]
_isz,_jsz = (M*K,RB)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end # if
if ( LSAME( JOB, 'U' ) || LSAME( JOB, 'A' ) )
vs = String[]
_isz,_jsz = (N*L,RC)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
C[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end # if
# interp call 1
INFO = SLICOT.mb02id!(JOB, K, L, M, N, RB, RC, TC, TR, B, C)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( LSAME( JOB, 'O' ) || LSAME( JOB, 'A' ) )
# interp output 1
println(io,"B:")
_nc = RB
_nr = N*L
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
end # if
if ( LSAME( JOB, 'U' ) || LSAME( JOB, 'A' ) )
# interp output 2
println(io,"C:")
_nc = RC
_nr = M*K
show(io,"text/plain",C[1:_nr,1:_nc])
println(io,)
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2040 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02jd(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 10
LMAX = 10
MMAX = 20
NMAX = 20
LDR = NMAX*LMAX
LDQ = MMAX*KMAX
LDTC = MMAX*KMAX
LDTR = KMAX
LDWORK = ( MMAX*KMAX + NMAX*LMAX ) *( LMAX + 2*KMAX ) + 6*LMAX + MMAX*KMAX + NMAX*LMAX
TC = Array{Float64,2}(undef, LDTC,LMAX)
TR = Array{Float64,2}(undef, LDTR,NMAX*LMAX)
Q = Array{Float64,2}(undef, LDQ,NMAX*LMAX)
R = Array{Float64,2}(undef, LDR,NMAX*LMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
K = parse(BlasInt, vs[1])
L = parse(BlasInt, vs[2])
M = parse(BlasInt, vs[3])
N = parse(BlasInt, vs[4])
JOB = vs[5][1]
if ( K<=0 || K>KMAX )
elseif ( L<=0 || L>LMAX )
elseif ( M<=0 || M>MMAX )
elseif ( N<=0 || N>NMAX )
else
vs = String[]
_isz,_jsz = (M*K,L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TC[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (K,N*L-L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TR[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
S = (min(M*K,N*L)+L-1) ÷ L
# interp call 1
INFO = SLICOT.mb02jd!(JOB, K, L, M, N, 0, S, TC, TR, Q, R)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( LSAME( JOB, 'Q' ) )
# interp output 1
println(io,"Q:")
_nc = min( N*L, M*K )
_nr = M*K
show(io,"text/plain",Q[1:_nr,1:_nc])
println(io,)
end # if
# interp output 2
println(io,"R:")
_nc = min( N*L, M*K )
_nr = N*L
show(io,"text/plain",R[1:_nr,1:_nc])
println(io,)
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2312 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02jx(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 20
LMAX = 20
MMAX = 20
NMAX = 20
LDR = NMAX*LMAX
LDQ = MMAX*KMAX
LDTC = MMAX*KMAX
LDTR = KMAX
LDWORK = ( MMAX*KMAX + NMAX*LMAX ) *( LMAX + 2*KMAX ) + 5*LMAX + MMAX*KMAX + NMAX*LMAX
TC = Array{Float64,2}(undef, LDTC,LMAX)
TR = Array{Float64,2}(undef, LDTR,NMAX*LMAX)
Q = Array{Float64,2}(undef, LDQ,NMAX*LMAX)
R = Array{Float64,2}(undef, LDR,NMAX*LMAX)
JPVT = Array{BlasInt,1}(undef, NMAX*LMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
K = parse(BlasInt, vs[1])
L = parse(BlasInt, vs[2])
M = parse(BlasInt, vs[3])
N = parse(BlasInt, vs[4])
TOL1 = parse(Float64, replace(vs[5],'D'=>'E'))
TOL2 = parse(Float64, replace(vs[6],'D'=>'E'))
JOB = vs[7][1]
if ( K<=0 || K>KMAX )
elseif ( L<=0 || L>LMAX )
elseif ( M<=0 || M>MMAX )
elseif ( N<=0 || N>NMAX )
else
vs = String[]
_isz,_jsz = (M*K,L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TC[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (K,N*L-L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TR[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
RNK, INFO = SLICOT.mb02jx!(JOB, K, L, M, N, TC, TR, Q, R, JPVT, TOL1, TOL2, LDWORK)
println(io, "RNK = $RNK")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( LSAME( JOB, 'Q' ) )
# interp output 1
println(io,"Q:")
_nc = RNK
_nr = M*K
show(io,"text/plain",Q[1:_nr,1:_nc])
println(io,)
end # if
# interp output 2
println(io,"R:")
_nc = RNK
_nr = N*L
show(io,"text/plain",R[1:_nr,1:_nc])
println(io,)
# interp output 3
println(io,"JPVT:")
_nr = min( M*K, N*L )
show(io,"text/plain",JPVT[1:_nr])
println(io,)
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3517 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02kd(datfile, io=stdout)
ZERO = 0.0e0
ONE = 1.0e0
NIN = 5
NOUT = 6
KMAX = 20
LMAX = 20
MMAX = 20
NMAX = 20
RMAX = 20
LDB = LMAX*NMAX
LDC = KMAX*MMAX
LDTC = MMAX*KMAX
LDTR = KMAX
LDWORK = 2*( KMAX*LMAX + KMAX*RMAX + LMAX*RMAX + 1 )*( MMAX + NMAX )
TC = Array{Float64,2}(undef, LDTC,LMAX)
TR = Array{Float64,2}(undef, LDTR,NMAX*LMAX)
B = Array{Float64,2}(undef, LDB,RMAX)
C = Array{Float64,2}(undef, LDC,RMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
K = parse(BlasInt, vs[1])
L = parse(BlasInt, vs[2])
M = parse(BlasInt, vs[3])
N = parse(BlasInt, vs[4])
R = parse(BlasInt, vs[5])
LDBLK = vs[6][1]
TRANS = vs[7][1]
if ( K<=0 || K>KMAX )
@error "Illegal K=$K"
elseif ( L<=0 || L>LMAX )
@error "Illegal L=$L"
elseif ( M<=0 || M>MMAX )
@error "Illegal M=$M"
elseif ( N<=0 || N>NMAX )
@error "Illegal N=$N"
elseif ( R<=0 || R>RMAX )
@error "Illegal R=*R"
end
if ( LSAME( LDBLK, 'R' ) )
vs = String[]
_isz,_jsz = ((M-1)*K,L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TC[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (K,N*L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TR[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
else
vs = String[]
_isz,_jsz = (M*K,L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TC[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (K,(N-1)*L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
TR[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end # if
if ( LSAME( TRANS, 'N' ) )
vs = String[]
_isz,_jsz = (N*L,R)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
else
vs = String[]
_isz,_jsz = (M*K,R)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end # if
close(f)
ALPHA = ONE
BETA = ZERO
# interp call 1
INFO = SLICOT.mb02kd!(LDBLK, TRANS, K, L, M, N, R, ALPHA, BETA, TC, TR, B, C)
@test INFO == 0
INFO == 0 || return
if ( LSAME( TRANS, 'N' ) )
# interp output 1
println(io, "C:")
_nc = R
_nr = M*K
show(io, "text/plain", C[1:_nr,1:_nc])
println(io)
else
# interp output 2
println(io, "C:")
_nc = R
_nr = N*L
show(io, "text/plain", C[1:_nr,1:_nc])
println(io)
end # if
end # run_mb02kd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2296 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02md(datfile, io=stdout)
NIN = 5
NOUT = 6
MMAX = 20
NMAX = 20
LMAX = 20
LDC = max( MMAX,NMAX+LMAX )
LDX = NMAX
LDWORK = MMAX*(NMAX+LMAX) + max( 3*min(MMAX,NMAX+LMAX) + max(MMAX,NMAX+LMAX), 5*min(MMAX,NMAX+LMAX), 3*LMAX )
LIWORK = LMAX
LENGS = min( MMAX, NMAX+LMAX )
C = Array{Float64,2}(undef, LDC,NMAX+LMAX)
S = Array{Float64,1}(undef, LENGS)
X = Array{Float64,2}(undef, LDX,LMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, LIWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
M = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
L = parse(BlasInt, vs[3])
JOB = vs[4][1]
if ( LSAME( JOB, 'R' ) )
vs = split(readline(f))
TOL = parse(Float64, replace(vs[1],'D'=>'E'))
elseif ( LSAME( JOB, 'T' ) )
vs = split(readline(f))
RANK = parse(BlasInt, vs[1])
SDEV = parse(Float64, replace(vs[2],'D'=>'E'))
TOL = SDEV
elseif ( LSAME( JOB, 'N' ) )
vs = split(readline(f))
RANK = parse(BlasInt, vs[1])
TOL = parse(Float64, replace(vs[2],'D'=>'E'))
else
RANK = 0
vs = split(readline(f))
SDEV = parse(Float64, replace(vs[1],'D'=>'E'))
TOL = SDEV
end # if
if ( M<0 || M>MMAX )
elseif ( N<0 || N>NMAX )
elseif ( L<0 || L>LMAX )
else
vs = String[]
_isz,_jsz = (M,N+L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
C[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
RANK, INFO, IWARN = SLICOT.mb02md!(JOB, M, N, L, RANK, C, S, X, TOL)
println(io, "RANK = $RANK")
@test INFO == 0
INFO == 0 || return
println(io, "IWARN = $IWARN")
if ( INFO!=0 )
else
if ( IWARN!=0 )
else
end # if
# unable to translate write statement:
# in do block [('40', 'J', 'L'), ('20', 'I', 'N')]
# write X(I,J)
println(io, "X:")
_nr = N
_nc = L
show(io, "text/plain", X[1:_nr,1:_nc])
println(io)
# interp output 1
println(io, "S:")
_nr = min( M, N+L )
show(io, "text/plain", S[1:_nr])
println(io)
end # if
end # if
close(f)
end # run_mb02md()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2539 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02nd(datfile, io=stdout)
ZERO = 0.0e0
NIN = 5
NOUT = 6
MMAX = 20
NMAX = 20
LMAX = 20
LDC = max( MMAX, NMAX+LMAX )
LDX = NMAX
LENGQ = 2*min(MMAX,NMAX+LMAX)-1
LIWORK = NMAX+2*LMAX
LDWORK = max(2, max( MMAX, NMAX+LMAX ) + 2*min( MMAX, NMAX+LMAX ), min( MMAX, NMAX+LMAX ) + max( ( NMAX+LMAX )*( NMAX+LMAX-1 )÷2, MMAX*( NMAX+LMAX-( MMAX-1 )÷2 ) ) + max( 6*(NMAX+LMAX)-5, LMAX*LMAX + max( NMAX+LMAX, 3*LMAX ) ) )
LBWORK = NMAX+LMAX
C = Array{Float64,2}(undef, LDC,NMAX+LMAX)
X = Array{Float64,2}(undef, LDX,LMAX)
Q = Array{Float64,1}(undef, LENGQ)
INUL = Array{BlasBool,1}(undef, NMAX+LMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, LIWORK)
BWORK = Array{BlasBool,1}(undef, LBWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
M = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
L = parse(BlasInt, vs[3])
RANK = parse(BlasInt, vs[4])
THETA = parse(Float64, replace(vs[5],'D'=>'E'))
TOL = parse(Float64, replace(vs[6],'D'=>'E'))
RELTOL = parse(Float64, replace(vs[7],'D'=>'E'))
if ( M<0 || M>MMAX )
elseif ( N<0 || N>NMAX )
elseif ( L<0 || L>LMAX )
elseif ( RANK>min( MMAX, NMAX ) )
elseif ( RANK<0 && THETA<ZERO )
else
vs = String[]
_isz,_jsz = (M,N+L)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
C[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
RANK1 = RANK
THETA1 = THETA
# interp call 1
RANK, THETA, INFO, IWARN = SLICOT.mb02nd!(M, N, L, RANK, THETA, C, X, Q, INUL, TOL, RELTOL)
println(io, "RANK = $RANK")
println(io, "THETA = $THETA")
@test INFO == 0
INFO == 0 || return
println(io, "IWARN = $IWARN")
if ( INFO!=0 )
else
if ( IWARN!=0 )
else
end # if
MINMNL = min( M, N+L )
LOOP = MINMNL - 1
println(io, "Q:")
show(io, "text/plain", Bidiagonal(Q[1:MINMNL],Q[MINMNL+1:MINMNL+LOOP],'U'))
println(io)
println(io, "X:")
show(io, "text/plain", X[1:N,1:L])
println(io)
# interp output 1
println(io, "C:")
_nc = N+L
_nr = max( M, N + L )
show(io, "text/plain", C[1:_nr,1:_nc])
println(io)
inul = convert(Vector{Bool}, INUL[1:N+L])
println(io, "INUL:")
show(io, "text/plain", inul[1:N+L])
println(io)
end # if
end # if
close(f)
end # run_mb02nd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1954 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02qd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
MMAX = 20
NRHSMX = 20
LDA = MMAX
LDB = max( MMAX, NMAX )
LDWORK = max( min( MMAX, NMAX) + 3*NMAX + 1, 2*min( MMAX, NMAX) + NRHSMX )
A = Array{Float64,2}(undef, LDA,NMAX)
B = Array{Float64,2}(undef, LDB,NRHSMX)
Y = Array{Float64,1}(undef, NMAX*NRHSMX)
JPVT = Array{BlasInt,1}(undef, NMAX)
SVAL = Array{Float64,1}(undef, 3)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
M = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
NRHS = parse(BlasInt, vs[3])
RCOND = parse(Float64, replace(vs[4],'D'=>'E'))
SVLMAX = parse(Float64, replace(vs[5],'D'=>'E'))
JOB = vs[6][1]
INIPER = vs[7][1]
if ( M<0 || M>MMAX )
else
if ( N<0 || N>NMAX )
else
if ( NRHS<0 || NRHS>NRHSMX )
else
vs = String[]
_isz,_jsz = (M,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,NRHS)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
RANK, INFO = SLICOT.mb02qd!(JOB, INIPER, M, N, NRHS, RCOND, SVLMAX, A, B, Y, JPVT, SVAL, LDWORK)
println(io, "RANK = $RANK")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
# interp output 1
println(io,"B:")
_nc = NRHS
_nr = N
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
end # if
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2233 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02sd(datfile, io=stdout)
ZERO = 0.0e0
NIN = 5
NOUT = 6
NMAX = 20
NRHMAX = 20
LDB = NMAX
LDH = NMAX
LDWORK = 3*NMAX
LIWORK = NMAX
H = Array{Float64,2}(undef, LDH,NMAX)
IPIV = Array{BlasInt,1}(undef, NMAX)
B = Array{Float64,2}(undef, LDB,NRHMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, LIWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
NRHS = parse(BlasInt, vs[2])
NORM = vs[3][1]
TRANS = vs[4][1]
if ( N<0 || N>NMAX )
else
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
H[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
if ( NRHS<0 || NRHS>NRHMAX )
else
vs = String[]
_isz,_jsz = (N,NRHS)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
if N>2
# interp call 1
#FOREIGN.dlaset!( 'Lower', N-2, N-2, ZERO, ZERO, H(3,1), LDH )
triu!(H, -1)
end
# interp call 2
INFO = SLICOT.mb02sd!(N, H, IPIV)
@test INFO == 0
INFO == 0 || return
#HNORM = DLANHS( NORM, N, H, LDH, DWORK )
HNORM = ccall((LinearAlgebra.BLAS.@blasfunc(dlanhs_), LinearAlgebra.LAPACK.liblapack),
Float64, (Ref{UInt8}, Ref{BlasInt}, Ptr{Float64}, Ref{BlasInt},
Ptr{Float64}), NORM, N, H, LDH, DWORK)
# interp call 3
RCOND, INFO = SLICOT.mb02td!(NORM, N, HNORM, H, IPIV)
println(io, "RCOND = $RCOND")
@test INFO == 0
INFO == 0 || return
if ( INFO==0 && RCOND>eps(0.9) )
# interp call 4
INFO = SLICOT.mb02rd!(TRANS, N, NRHS, H, IPIV, B)
@test INFO == 0
INFO == 0 || return
else
end # if
# interp output 1
println(io, "B:")
_nc = NRHS
_nr = N
show(io, "text/plain", B[1:_nr,1:_nc])
println(io)
end # if
end # if
close(f)
end # run_mb02sd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1425 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb02vd(datfile, io=stdout)
NIN = 5
NOUT = 6
MMAX = 20
NMAX = 20
LDA = NMAX
LDB = MMAX
A = Array{Float64,2}(undef, LDA,NMAX)
IPIV = Array{BlasInt,1}(undef, NMAX)
B = Array{Float64,2}(undef, LDB,NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
M = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
TRANS = vs[3][1]
if ( N<0 || N>NMAX )
else
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
if ( M<0 || M>MMAX )
else
vs = String[]
_isz,_jsz = (M,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
INFO = SLICOT.mb02vd!(TRANS, M, N, A, IPIV, B)
@test INFO == 0
INFO == 0 || return
if ( INFO==0 )
# interp output 1
println(io,"B:")
_nc = N
_nr = M
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
else
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3273 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03bd(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 6
NMAX = 50
LDA1 = NMAX
LDA2 = NMAX
LDQ1 = NMAX
LDQ2 = NMAX
LDWORK = KMAX + max( 2*NMAX, 8*KMAX )
LIWORK = 2*KMAX + NMAX
QIND = Array{BlasInt,1}(undef, KMAX)
S = Array{BlasInt,1}(undef, KMAX)
A = Array{Float64,3}(undef, LDA1,LDA2,KMAX)
Q = Array{Float64,3}(undef, LDQ1,LDQ2,KMAX)
ALPHAR = Array{Float64,1}(undef, NMAX)
ALPHAI = Array{Float64,1}(undef, NMAX)
BETA = Array{Float64,1}(undef, NMAX)
SCAL = Array{BlasInt,1}(undef, NMAX)
IWORK = Array{BlasInt,1}(undef, LIWORK)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
JOB = vs[1][1]
DEFL = vs[2][1]
COMPQ = vs[3][1]
K = parse(BlasInt, vs[4])
N = parse(BlasInt, vs[5])
H = parse(BlasInt, vs[6])
ILO = parse(BlasInt, vs[7])
IHI = parse(BlasInt, vs[8])
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz = K
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
S[1:_isz] .= parsex.(BlasInt, vs)
vs = String[]
_isz,_jsz,_ksz = (N,N,K)
while length(vs) < _isz*_jsz*_ksz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for k in 1:_ksz
for i in 1:_isz
_i0 = (i-1)*_jsz + (k-1)*_jsz*_isz
A[i,1:_jsz,k] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end
if ( LSAME( COMPQ, 'P' ) )
vs = String[]
_isz = K
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
QIND[1:_isz] .= parsex.(BlasInt, vs)
end # if
close(f)
# interp call 1
INFO, IWARN = SLICOT.mb03bd!(JOB, DEFL, COMPQ, QIND, K, N, H, ILO, IHI, S, A, Q, ALPHAR, ALPHAI, BETA, SCAL, LIWORK, LDWORK)
@test INFO == 0
println(io, "IWARN = $IWARN")
if ( LSAME( JOB, 'S' ) || LSAME( JOB, 'T' ) )
# interp output 1
println(io, "A:")
_nc = N
_nr = N
_nk = K
show(io, "text/plain", A[1:_nr,1:_nc,1:_nk])
println(io)
end # if
if ( LSAME( COMPQ, 'U' ) || LSAME( COMPQ, 'I' ) )
# interp output 2
println(io, "Q:")
_nc = N
_nr = N
_nk = K
show(io, "text/plain", Q[1:_nr,1:_nc,1:_nk])
println(io)
elseif ( LSAME( COMPQ, 'P' ) )
for L in 1:K
if ( QIND[L]>0 )
println(io, "factor ",QIND[L])
# write QIND( L )
# unable to translate write loop:
# write ( I, J, QIND( L ) ), J = 1, N
# interp output 3
show(io, "text/plain", Q[1:N,1:N,QIND[L]])
println(io)
end # if
end # for
end # if
# interp output 4
println(io, "ALPHAR:")
_nr = N
show(io, "text/plain", ALPHAR[1:_nr])
println(io)
# interp output 5
println(io, "ALPHAI:")
_nr = N
show(io, "text/plain", ALPHAI[1:_nr])
println(io)
# interp output 6
println(io, "BETA:")
_nr = N
show(io, "text/plain", BETA[1:_nr])
println(io)
# interp output 7
println(io, "SCAL:")
_nr = N
show(io, "text/plain", SCAL[1:_nr])
println(io)
end # run_mb03bd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2375 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03bz(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 6
NMAX = 50
LDA1 = NMAX
LDA2 = NMAX
LDQ1 = NMAX
LDQ2 = NMAX
LDWORK = NMAX
LZWORK = NMAX
S = Array{BlasInt,1}(undef, KMAX)
A = Array{ComplexF64,3}(undef, LDA1,LDA2,KMAX)
Q = Array{ComplexF64,3}(undef, LDQ1,LDQ2,KMAX)
ALPHA = Array{ComplexF64,1}(undef, NMAX)
BETA = Array{ComplexF64,1}(undef, NMAX)
SCAL = Array{BlasInt,1}(undef, NMAX)
ZWORK = Array{ComplexF64,1}(undef, LZWORK)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
JOB = vs[1][1]
COMPQ = vs[2][1]
K = parse(BlasInt, vs[3])
N = parse(BlasInt, vs[4])
ILO = parse(BlasInt, vs[5])
IHI = parse(BlasInt, vs[6])
if ( N<0 || N>NMAX )
else
vs = String[]
_isz = K
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
S[1:_isz] .= parsex.(BlasInt, vs)
vs = String[]
_isz,_jsz,_ksz = (N,N,K)
while length(vs) < _isz*_jsz*_ksz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for k in 1:_ksz
for i in 1:_isz
_i0 = (i-1)*_jsz + (k-1)*_jsz*_isz
A[i,1:_jsz,k] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
end
# interp call 1
INFO = SLICOT.mb03bz!(JOB, COMPQ, K, N, ILO, IHI, S, A, Q, ALPHA, BETA, SCAL, LDWORK, LZWORK)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( LSAME( JOB, 'S' ) )
# interp output 1
println(io,"A:")
_nc = N
_nr = N
_nk = K
show(io,"text/plain",A[1:_nr,1:_nc,1:_nk])
println(io,)
end # if
if ( !LSAME( COMPQ, 'N' ) )
# interp output 2
println(io,"Q:")
_nc = N
_nr = N
_nk = K
show(io,"text/plain",Q[1:_nr,1:_nc,1:_nk])
println(io,)
end # if
# interp output 3
println(io,"ALPHA:")
_nr = N
show(io,"text/plain",ALPHA[1:_nr])
println(io,)
# interp output 4
println(io,"BETA:")
_nr = N
show(io,"text/plain",BETA[1:_nr])
println(io,)
# interp output 5
println(io,"SCAL:")
_nr = N
show(io,"text/plain",SCAL[1:_nr])
println(io,)
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3697 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03fz(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 50
LDB = NMAX
LDC = NMAX
LDD = NMAX
LDFG = NMAX
LDQ = 2*NMAX
LDU = NMAX
LDWORK = 18*NMAX*NMAX + NMAX + 3 + max( 2*NMAX, 24 )
LDZ = NMAX
LIWORK = 2*NMAX + 9
LZWORK = 8*NMAX + 28
Z = Array{ComplexF64,2}(undef, LDZ,NMAX)
B = Array{ComplexF64,2}(undef, LDB,NMAX)
FG = Array{ComplexF64,2}(undef, LDFG,NMAX)
D = Array{ComplexF64,2}(undef, LDD,NMAX)
C = Array{ComplexF64,2}(undef, LDC,NMAX)
Q = Array{ComplexF64,2}(undef, LDQ,2*NMAX)
U = Array{ComplexF64,2}(undef, LDU,2*NMAX)
ALPHAR = Array{Float64,1}(undef, NMAX)
ALPHAI = Array{Float64,1}(undef, NMAX)
BETA = Array{Float64,1}(undef, NMAX)
BWORK = Array{BlasBool,1}(undef, NMAX)
ZWORK = Array{ComplexF64,1}(undef, LZWORK)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, LIWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
COMPQ = vs[1][1]
COMPU = vs[2][1]
ORTH = vs[3][1]
N = parse(BlasInt, vs[4])
if ( N<0 || N>NMAX || mod( N, 2 )!=0 )
else
M = N÷2
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
Z[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
FG[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
NEIG, INFO = SLICOT.mb03fz!(COMPQ, COMPU, ORTH, N, Z, B, FG, D, C, Q, U, ALPHAR, ALPHAI, BETA, LIWORK, BWORK)
println(io, "NEIG = $NEIG")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
# interp output 1
println(io,"Z:")
_nc = N
_nr = N
show(io,"text/plain",Z[1:_nr,1:_nc])
println(io,)
if ( LSAME( COMPQ, 'C' ) || LSAME( COMPU, 'C' ) )
# interp output 2
println(io,"D:")
_nc = N
_nr = N
show(io,"text/plain",D[1:_nr,1:_nc])
println(io,)
# interp output 3
println(io,"C:")
_nc = N
_nr = N
show(io,"text/plain",C[1:_nr,1:_nc])
println(io,)
# interp output 4
println(io,"B:")
_nc = N
_nr = N
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
# interp output 5
println(io,"FG:")
_nc = N
_nr = N
show(io,"text/plain",FG[1:_nr,1:_nc])
println(io,)
end # if
# interp output 6
println(io,"ALPHAR:")
_nr = N
show(io,"text/plain",ALPHAR[1:_nr])
println(io,)
# interp output 7
println(io,"ALPHAI:")
_nr = N
show(io,"text/plain",ALPHAI[1:_nr])
println(io,)
# interp output 8
println(io,"BETA:")
_nr = N
show(io,"text/plain",BETA[1:_nr])
println(io,)
if ( LSAME( COMPQ, 'C' ) && NEIG>0 )
# interp output 9
println(io,"Q:")
_nc = NEIG
_nr = N
show(io,"text/plain",Q[1:_nr,1:_nc])
println(io,)
end # if
if ( LSAME( COMPU, 'C' ) && NEIG>0 )
# interp output 10
println(io,"U:")
_nc = NEIG
_nr = N
show(io,"text/plain",U[1:_nr,1:_nc])
println(io,)
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 9007 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03kd(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 6
NMAX = 50
LDA1 = NMAX
LDA2 = NMAX
LDQ1 = NMAX
LDQ2 = NMAX
LDWORK = max( 42*KMAX + NMAX, 80*KMAX - 48, KMAX + max( 2*NMAX, 8*KMAX ) )
LIWORK = max( 4*KMAX, 2*KMAX + NMAX )
HUND = 1.0e2
ZERO = 0.0e0
QIND = Array{BlasInt,1}(undef, KMAX)
S = Array{BlasInt,1}(undef, KMAX)
A = Array{Float64,3}(undef, LDA1,LDA2,KMAX)
Q = Array{Float64,3}(undef, LDQ1,LDQ2,KMAX)
ALPHAR = Array{Float64,1}(undef, NMAX)
ALPHAI = Array{Float64,1}(undef, NMAX)
BETA = Array{Float64,1}(undef, NMAX)
SCAL = Array{BlasInt,1}(undef, NMAX)
ND = Array{BlasInt,1}(undef, KMAX)
NI = Array{BlasInt,1}(undef, KMAX)
SELECT = Array{Bool,1}(undef, NMAX)
T = Array{Float64,1}(undef, NMAX*NMAX*KMAX)
IXT = Array{BlasInt,1}(undef, KMAX)
QK = Array{Float64,1}(undef, NMAX*NMAX*KMAX)
IXQ = Array{BlasInt,1}(undef, KMAX)
# WARNING: desperate attempt to initialize M
M = 0
IWORK = Array{BlasInt,1}(undef, LIWORK)
LDQ = Array{BlasInt,1}(undef, KMAX)
LDT = Array{BlasInt,1}(undef, KMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
JOB = vs[1][1]
DEFL = vs[2][1]
COMPQ = vs[3][1]
STRONG = vs[4][1]
K = parse(BlasInt, vs[5])
N = parse(BlasInt, vs[6])
H = parse(BlasInt, vs[7])
ILO = parse(BlasInt, vs[8])
IHI = parse(BlasInt, vs[9])
if ( N<0 || N>NMAX )
@error "illegal N"
end
TOL = HUND
vs = String[]
_isz = K
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
S[1:_isz] .= parsex.(BlasInt, vs)
vs = String[]
_isz,_jsz,_ksz = (N,N,K)
while length(vs) < _isz*_jsz*_ksz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for k in 1:_ksz
for i in 1:_isz
_i0 = (i-1)*_jsz + (k-1)*_jsz*_isz
A[i,1:_jsz,k] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end
if ( LSAME( COMPQ, 'U' ) )
vs = String[]
_isz,_jsz,_ksz = (N,N,K)
while length(vs) < _isz*_jsz*_ksz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for k in 1:_ksz
for i in 1:_isz
_i0 = (i-1)*_jsz + (k-1)*_jsz*_isz
Q[i,1:_jsz,k] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end
end
if ( LSAME( COMPQ, 'P' ) )
vs = String[]
_isz = K
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
QIND[1:_isz] .= parsex.(BlasInt, vs)
vs = String[]
_isz,_jsz,_ksz = (N,N,K)
while length(vs) < _isz*_jsz*_ksz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for k in 1:_ksz
if QIND[k] > 0
for i in 1:_isz
_i0 = (i-1)*_jsz + (k-1)*_jsz*_isz
Q[i,1:_jsz,QIND[k]] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end
end
end # if
close(f)
if LSAME(JOB,'E')
JOB = 'S'
end
println(io, "JOB = $JOB")
println(io, "COMPQ = $COMPQ")
# interp call 1
INFO, IWARN = SLICOT.mb03bd!(JOB, DEFL, COMPQ, QIND, K, N, H, ILO, IHI, S, A, Q, ALPHAR, ALPHAI, BETA, SCAL, LIWORK, LDWORK)
@test INFO == 0
INFO == 0 || return
println(io, "IWARN = $IWARN")
if ( IWARN!=0 )
@warn "mb03bd returned IWARN=$IWARN"
end
verbose = false
if verbose
## added for diagnostic
if ( LSAME( JOB, 'S' ) || LSAME( JOB, 'T' ) )
# interp output 1
println(io, "after Schur (HessIdx=$H) A:")
_nc = N
_nr = N
_nk = K
show(io, "text/plain", A[1:_nr,1:_nc,1:_nk])
println(io)
end # if
if ( LSAME( COMPQ, 'U' ) || LSAME( COMPQ, 'I' ) )
println(io, "Q:")
_nc = N
_nr = N
_nk = K
show(io, "text/plain", Q[1:_nr,1:_nc,1:_nk])
println(io)
elseif ( LSAME( COMPQ, 'P' ) )
println(io, "TODO: show Q for COMPQ='P'")
for L in 1:K
#if ( QIND[L]>0 )
#println(io, "Q:")
#show(io, "text/plain", Q)
#println(io)
#nd # if
end # for
end # if
end ## diagnostic
# prepare data for calling MB03KD with screwy data structures and factor ordering
for L in 1:K
ND[L] = max(1,N)
NI[L] = 0
LDT[L] = max(1,N)
IXT[L] = (L-1)*LDT[L]*N + 1
LDQ[L] = max(1,N)
IXQ[L] = IXT[L]
if ( L<= K÷2 )
i = S[ K - L + 1 ]
S[K-L+1] = S[L]
S[L] = i
end # if
end
for L in 1:K
# interp call 2
# FOREIGN.dlacpy!( 'Full', N, N, A( 1, 1, K-L+1 ), LDA1, T( IXT( L ) ), LDT( L ) )
ir1 = IXT[L]
for ic in 1:N
T[ir1:ir1+N-1] .= A[1:N,ic,K-L+1]
ir1 += LDT[L]
end
end
if verbose
println(io, "stored T:")
for k in 1:K
println(io, "K=$k")
Ttmp = reshape(T[IXT[k]:IXT[k]+LDT[k]*N-1],N,N)
show(io, "text/plain", Ttmp)
println(io)
end
end # diagnostic
if ( LSAME( COMPQ, 'U' ) || LSAME( COMPQ, 'I' ) )
COMPQ = 'U'
for L in 1:K
# interp call 3
# FOREIGN.dlacpy!( 'Full', N, N, Q( 1, 1, K-L+1 ), LDQ1, QK( IXQ( L ) ), LDQ( L ) )
ir1 = IXQ[L]
for ic in 1:N
QK[ir1:ir1+N-1] .= Q[1:N,ic,K-L+1]
ir1 += LDQ[L]
end
end
elseif ( LSAME( COMPQ, 'P' ) )
COMPQ = 'W'
for L in 1:K
if QIND[L] < 0
QIND[L] = 2
end
P = QIND[L]
if P != 0
ir1 = IXQ[P]
Qk[ir1:ir1+N-1] .= Q[1:N,ic,K-P+1]
ir1 += LDQ[P]
end
end
end # if
if verbose # diag
println(io, "stored Q:")
for k in 1:K
println(io, "K=$k")
Ttmp = reshape(QK[IXQ[k]:IXQ[k]+LDQ[k]*N-1],N,N)
show(io, "text/plain", Ttmp)
println(io)
end
end
SELECT .= false
for i in 1:N
SELECT[i] = ALPHAR[i] < 0
end
# interp output 1
println(io, "ALPHAR:")
_nr = N
show(io, "text/plain", ALPHAR[1:_nr])
println(io)
# interp output 2
println(io, "ALPHAI:")
_nr = N
show(io, "text/plain", ALPHAI[1:_nr])
println(io)
# interp output 3
println(io, "BETA:")
_nr = N
show(io, "text/plain", BETA[1:_nr])
println(io)
# interp output 4
println(io, "SCAL:")
_nr = N
show(io, "text/plain", SCAL[1:_nr])
println(io)
# interp call 4
select = convert(Vector{BlasBool}, SELECT)
println(io, "select:"); show(io, "text/plain", select[1:K]); println()
M, INFO = SLICOT.mb03kd!(COMPQ, QIND, STRONG, K, N, H, ND, NI, S, select, T, LDT, IXT, QK, LDQ, IXQ, TOL)
@test INFO == 0
if INFO != 0
println(io, "mb03kd returned INFO = $INFO")
return
end
if ( INFO!=0 )
#@error "mb03kd returned INFO=$INFO"
end
Tf = zeros(N,N,K)
for L in 1:K
P = K - L + 1
ir1 = IXT[P]
for ic in 1:N
Tf[1:N,ic,L] .= T[ir1:ir1+N-1]
ir1 += LDT[P]
end
end
# unable to translate write loop:
# write ( IXT( P ) + I - 1 + ( J - 1 )*LDT( P ) ), J = 1, N
# interp output 5
println(io, "T:")
show(io, "text/plain", Tf)
println(io)
if ( LSAME( COMPQ, 'U' ) || LSAME( COMPQ, 'I' ) )
Qf = zeros(N,N,K)
for L in 1:K
P = K - L + 1
ir1 = IXQ[P]
for ic in 1:N
Qf[1:N,ic,L] .= QK[ir1:ir1+N-1]
ir1 += LDQ[P]
end
end
# unable to translate write loop:
# write ( IXQ( P ) + I - 1 + ( J - 1 )*LDQ( P ) ), J = 1, N
# interp output 6
println(io, "QK:")
show(io, "text/plain", Qf)
println(io)
elseif ( LSAME( COMPQ, 'W' ) )
for L in 1:K
if ( QIND[L]>0 )
println(io, "factor $(QIND[L]):")
Qf = zeros(N,N)
P = K - QIND[L] + 1
ir1 = IXQ[P]
for ic in 1:N
Qf[1:N,ic] .= QK[ir1:ir1+N-1]
ir1 += LDQ[P]
end
show(io, "text/plain", Qf)
println(io)
end
end
# unable to translate write loop:
# write ( IXQ( P ) + I - 1 + ( J - 1 )*LDQ( P ) ), J = 1, N
# interp output 7
end # if
end # module
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3311 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03ld(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 50
LDA = NMAX÷2
LDB = NMAX÷2
LDDE = NMAX÷2
LDFG = NMAX÷2
LDQ = 2*NMAX
LDWORK = 8*NMAX*NMAX + max( 8*NMAX + 32, NMAX÷2 + 168, 272 )
LIWORK = max( 32, NMAX + 12, NMAX*2 + 3 )
A = Array{Float64,2}(undef, LDA,NMAX÷2)
DE = Array{Float64,2}(undef, LDDE,NMAX÷2+1)
B = Array{Float64,2}(undef, LDB,NMAX÷2)
FG = Array{Float64,2}(undef, LDFG,NMAX÷2+1)
Q = Array{Float64,2}(undef, LDQ,2*NMAX)
ALPHAR = Array{Float64,1}(undef, NMAX÷2)
ALPHAI = Array{Float64,1}(undef, NMAX÷2)
BETA = Array{Float64,1}(undef, NMAX÷2)
BWORK = Array{BlasBool,1}(undef, NMAX÷2)
IWORK = Array{BlasInt,1}(undef, LIWORK)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
COMPQ = vs[1][1]
ORTH = vs[2][1]
N = parse(BlasInt, vs[3])
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
end
M = N÷2
vs = String[]
_isz,_jsz = (M,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
DE[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
FG[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
NEIG, INFO = SLICOT.mb03ld!(COMPQ, ORTH, N, A, DE, B, FG, Q, ALPHAR, ALPHAI, BETA, LIWORK)
@test INFO == 0
INFO == 0 || return
println(io, "NEIG = $NEIG")
# interp output 1
println(io, "A:")
_nc = M
_nr = M
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "DE:")
_nc = M+1
_nr = M
show(io, "text/plain", DE[1:_nr,1:_nc])
println(io)
# interp output 3
println(io, "B:")
_nc = M
_nr = M
show(io, "text/plain", B[1:_nr,1:_nc])
println(io)
# interp output 4
println(io, "FG:")
show(io, "text/plain", FG[1:M,2:M+1])
println(io)
# interp output 5
println(io, "ALPHAR:")
_nr = M
show(io, "text/plain", ALPHAR[1:_nr])
println(io)
# interp output 6
println(io, "ALPHAI:")
_nr = M
show(io, "text/plain", ALPHAI[1:_nr])
println(io)
# interp output 7
println(io, "BETA:")
_nr = M
show(io, "text/plain", BETA[1:_nr])
println(io)
if ( LSAME( COMPQ, 'C' ) && NEIG>0 )
# interp output 8
println(io, "Q:")
_nc = NEIG
_nr = N
show(io, "text/plain", Q[1:_nr,1:_nc])
println(io)
end # if
end # run_mb03ld()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3048 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03lf(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 50
LDB = NMAX÷2
LDFG = NMAX÷2
LDQ = 2*NMAX
LDU = NMAX
LDZ = NMAX
LDWORK = 10*NMAX*NMAX + max( NMAX*NMAX + max( NMAX÷2 + 252, 432 ), max( 8*NMAX + 48, 171 ) )
LIWORK = max( NMAX + 18, NMAX÷2 + 48, 5*NMAX÷2 + 1 )
Z = Array{Float64,2}(undef, LDZ,NMAX)
B = Array{Float64,2}(undef, LDB,NMAX÷2)
FG = Array{Float64,2}(undef, LDFG,NMAX÷2+1)
Q = Array{Float64,2}(undef, LDQ,2*NMAX)
U = Array{Float64,2}(undef, LDU,2*NMAX)
ALPHAR = Array{Float64,1}(undef, NMAX÷2)
ALPHAI = Array{Float64,1}(undef, NMAX÷2)
BETA = Array{Float64,1}(undef, NMAX÷2)
BWORK = Array{BlasBool,1}(undef, NMAX÷2)
IWORK = Array{BlasInt,1}(undef, LIWORK)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
COMPQ = vs[1][1]
COMPU = vs[2][1]
ORTH = vs[3][1]
N = parse(BlasInt, vs[4])
if ( N<0 || N>NMAX || mod( N, 2 )!=0 )
else
M = N÷2
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
Z[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
FG[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
NEIG, INFO, IWARN = SLICOT.mb03lf!(COMPQ, COMPU, ORTH, N, Z, B, FG, Q, U, ALPHAR, ALPHAI, BETA, LIWORK)
println(io, "NEIG = $NEIG")
@test INFO == 0
INFO == 0 || return
println(io, "IWARN = $IWARN")
if ( INFO!=0 )
else
# interp output 1
println(io,"Z:")
_nc = N
_nr = N
show(io,"text/plain",Z[1:_nr,1:_nc])
println(io,)
# interp output 2
println(io,"ALPHAR:")
_nr = M
show(io,"text/plain",ALPHAR[1:_nr])
println(io,)
# interp output 3
println(io,"ALPHAI:")
_nr = M
show(io,"text/plain",ALPHAI[1:_nr])
println(io,)
# interp output 4
println(io,"BETA:")
_nr = M
show(io,"text/plain",BETA[1:_nr])
println(io,)
if ( LSAME( COMPQ, 'C' ) && NEIG>0 )
# interp output 5
println(io,"Q:")
_nc = NEIG
_nr = N
show(io,"text/plain",Q[1:_nr,1:_nc])
println(io,)
end # if
if ( LSAME( COMPU, 'C' ) && NEIG>0 )
# interp output 6
println(io,"U:")
_nc = NEIG
_nr = N
show(io,"text/plain",U[1:_nr,1:_nc])
println(io,)
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3433 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03lz(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 50
LDA = NMAX
LDB = NMAX
LDDE = NMAX
LDFG = NMAX
LDQ = 2*NMAX
LDWORK = 11*NMAX*NMAX + 2*NMAX
LZWORK = 8*NMAX + 4
A = Array{ComplexF64,2}(undef, LDA,NMAX)
DE = Array{ComplexF64,2}(undef, LDDE,NMAX)
B = Array{ComplexF64,2}(undef, LDB,NMAX)
FG = Array{ComplexF64,2}(undef, LDFG,NMAX)
Q = Array{ComplexF64,2}(undef, LDQ,2*NMAX)
ALPHAR = Array{Float64,1}(undef, NMAX)
ALPHAI = Array{Float64,1}(undef, NMAX)
BETA = Array{Float64,1}(undef, NMAX)
BWORK = Array{BlasBool,1}(undef, NMAX)
ZWORK = Array{ComplexF64,1}(undef, LZWORK)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, NMAX+1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
COMPQ = vs[1][1]
ORTH = vs[2][1]
N = parse(BlasInt, vs[3])
vs = String[]
_isz,_jsz = (N÷2,N÷2)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N÷2,N÷2+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
DE[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N÷2,N÷2)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N÷2,N÷2+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
FG[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
if ( N<0 || N>NMAX || mod( N, 2 )!=0 )
else
# interp call 1
NEIG, INFO = SLICOT.mb03lz!(COMPQ, ORTH, N, A, DE, B, FG, Q, ALPHAR, ALPHAI, BETA, BWORK)
println(io, "NEIG = $NEIG")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( LSAME( COMPQ, 'C' ) )
# interp output 1
println(io,"A:")
_nc = N
_nr = N
show(io,"text/plain",A[1:_nr,1:_nc])
println(io,)
# interp output 2
println(io,"DE:")
_nc = N
_nr = N
show(io,"text/plain",DE[1:_nr,1:_nc])
println(io,)
# interp output 3
println(io,"B:")
_nc = N
_nr = N
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
# interp output 4
println(io,"FG:")
_nc = N
_nr = N
show(io,"text/plain",FG[1:_nr,1:_nc])
println(io,)
end # if
# interp output 5
println(io,"ALPHAR:")
_nr = N
show(io,"text/plain",ALPHAR[1:_nr])
println(io,)
# interp output 6
println(io,"ALPHAI:")
_nr = N
show(io,"text/plain",ALPHAI[1:_nr])
println(io,)
# interp output 7
println(io,"BETA:")
_nr = N
show(io,"text/plain",BETA[1:_nr])
println(io,)
if ( LSAME( COMPQ, 'C' ) && NEIG>0 )
# interp output 8
println(io,"Q:")
_nc = NEIG
_nr = N
show(io,"text/plain",Q[1:_nr,1:_nc])
println(io,)
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1754 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03md(datfile, io=stdout)
ZERO = 0.0e0
NIN = 5
NOUT = 6
NMAX = 20
Q = Array{Float64,1}(undef, NMAX)
E = Array{Float64,1}(undef, NMAX-1)
Q2 = Array{Float64,1}(undef, NMAX)
E2 = Array{Float64,1}(undef, NMAX-1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
THETA = parse(Float64, replace(vs[2],'D'=>'E'))
L = parse(BlasInt, vs[3])
TOL = parse(Float64, replace(vs[4],'D'=>'E'))
RELTOL = parse(Float64, replace(vs[5],'D'=>'E'))
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
end
if ( L<0 || L>N )
@error "Illegal L=$L"
end
vs = String[]
_isz = N
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
Q[1:_isz] .= parsex.(Float64, vs)
vs = String[]
_isz = N-1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
E[1:_isz] .= parsex.(Float64, vs)
close(f)
println(io, "J:")
show(io, "text/plain", Bidiagonal(Q[1:N],E[1:N-1],:U))
println(io)
Q2[N] = Q[N]^2
PIVMIN = Q2[N]
for i in 1:N-1
Q2[i] = Q[i]^2
E2[i] = E[i]^2
PIVMIN = max( PIVMIN, Q2[i], E2[i] )
end
SAFMIN = floatmin(1.0)
PIVMIN = max( PIVMIN*SAFMIN, SAFMIN )
TOL = max( TOL, ZERO )
if RELTOL <= 0
RELTOL = 2.0 * eps(1.0)
end
# interp call 1
L, THETA, INFO, IWARN = SLICOT.mb03md!(N, L, THETA, Q, E, Q2, E2, PIVMIN, TOL, RELTOL)
@test INFO == 0
println(io, "L = $L")
println(io, "THETA = $THETA")
println(io, "IWARN = $IWARN")
end # run_mb03md()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1385 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03nd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
Q2 = Array{Float64,1}(undef, NMAX)
E2 = Array{Float64,1}(undef, NMAX-1)
E = Array{Float64,1}(undef, NMAX-1)
Q = Array{Float64,1}(undef, NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
THETA = parse(Float64, replace(vs[2],'D'=>'E'))
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz = N
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
Q[1:_isz] .= parsex.(Float64, vs)
vs = String[]
_isz = N-1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
E[1:_isz] .= parsex.(Float64, vs)
close(f)
println(io, "J:")
show(io, "text/plain", Bidiagonal(Q[1:N],E[1:N-1],:U))
println(io)
Q2[N] = Q[N]^2
PIVMIN = Q2[N]
for i in 1:N-1
Q2[i] = Q[i]^2
E2[i] = E[i]^2
PIVMIN = max( PIVMIN, Q2[i], E2[i] )
end
SAFMIN = floatmin(1.0)
PIVMIN = max( PIVMIN*SAFMIN, SAFMIN )
NUMSV, INFO = SLICOT.mb03nd!(N, THETA, Q2, E2, PIVMIN)
@test INFO == 0
println(io, "NUMSV = $NUMSV")
println(io, "THETA = $THETA")
end # run_mb03nd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1558 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03od(datfile, io=stdout)
ZERO = 0.0e0
ONE = 1.0e0
NIN = 5
NOUT = 6
NMAX = 10
MMAX = 10
LDA = NMAX
LDTAU = min(MMAX,NMAX)
LDWORK = 3*NMAX + 1
A = Array{Float64,2}(undef, LDA,NMAX)
JPVT = Array{BlasInt,1}(undef, NMAX)
TAU = Array{Float64,1}(undef, LDTAU)
SVAL = Array{Float64,1}(undef, 3)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
M = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
JOBQR = vs[3][1]
RCOND = parse(Float64, replace(vs[4],'D'=>'E'))
SVLMAX = parse(Float64, replace(vs[5],'D'=>'E'))
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
end
if ( M<0 || M>MMAX )
@error "Illegal M=$M"
end
vs = String[]
_isz,_jsz = (M,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
JPVT[1:N] .= 0
RANK, INFO = SLICOT.mb03od!(JOBQR, M, N, A, JPVT, RCOND, SVLMAX, TAU, SVAL)
@test INFO == 0
println(io, "RANK = $RANK")
# interp output 1
println(io, "JPVT:")
_nr = N
show(io, "text/plain", JPVT[1:_nr])
println(io)
# interp output 2
println(io, "SVAL:")
_nr = 3
show(io, "text/plain", SVAL[1:_nr])
println(io)
end # run_mb03od()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1559 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03pd(datfile, io=stdout)
ZERO = 0.0e0
ONE = 1.0e0
NIN = 5
NOUT = 6
NMAX = 10
MMAX = 10
LDA = NMAX
LDTAU = min(MMAX,NMAX)
LDWORK = 3*MMAX
A = Array{Float64,2}(undef, LDA,NMAX)
JPVT = Array{BlasInt,1}(undef, MMAX)
TAU = Array{Float64,1}(undef, LDTAU)
SVAL = Array{Float64,1}(undef, 3)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
M = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
JOBRQ = vs[3][1]
RCOND = parse(Float64, replace(vs[4],'D'=>'E'))
SVLMAX = parse(Float64, replace(vs[5],'D'=>'E'))
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
end
if ( M<0 || M>MMAX )
@error "Illegal M=$M"
end
vs = String[]
_isz,_jsz = (M,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
JPVT[1:M] .= 0
# interp call 1
RANK, INFO = SLICOT.mb03pd!(JOBRQ, M, N, A, JPVT, RCOND, SVLMAX, TAU, SVAL, LDWORK)
@test INFO == 0
println(io, "RANK = $RANK")
# interp output 1
println(io, "JPVT:")
_nr = M
show(io, "text/plain", JPVT[1:_nr])
println(io)
# interp output 2
println(io, "SVAL:")
_nr = 3
show(io, "text/plain", SVAL[1:_nr])
println(io)
end # run_mb03pd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1972 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03qd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 10
LDA = NMAX
LDU = NMAX
LDWORK = 3*NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
U = Array{Float64,2}(undef, LDU,NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
WI = Array{Float64,1}(undef, NMAX)
WR = Array{Float64,1}(undef, NMAX)
BWORK = Array{Bool,1}(undef, NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
NLOW = parse(BlasInt, vs[2])
NSUP = parse(BlasInt, vs[3])
ALPHA = parse(Float64, replace(vs[4],'D'=>'E'))
DICO = vs[5][1]
STDOM = vs[6][1]
JOBU = vs[7][1]
if ( N<0 || N>NMAX )
@error "invalid N=$N"
else
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
#FOREIGN.dgees!( 'Vectors', 'Not sorted', SELECT, N, A, LDA, NDIM, WR, WI, U, LDU, DWORK, LDWORK, BWORK, INFO )
Aschur = schur(A[1:N,1:N])
WR[1:N] .= real.(Aschur.values)
WI[1:N] .= imag.(Aschur.values)
U[1:N,1:N] .= Aschur.Z
A[1:N,1:N] .= Aschur.T
println(io, "orig T:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp call 2
NDIM, INFO = SLICOT.mb03qd!(DICO, STDOM, JOBU, N, NLOW, NSUP, ALPHA, A, U)
println(io, "NDIM = $NDIM")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "U:")
_nc = N
_nr = N
show(io, "text/plain", U[1:_nr,1:_nc])
println(io)
end # if
end # if
close(f)
end # run_mb03qd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2924 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03qg(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 10
LDA = NMAX
LDE = NMAX
LDU = NMAX
LDV = NMAX
LDWORK = 8*NMAX + 16
A = Array{Float64,2}(undef, LDA,NMAX)
E = Array{Float64,2}(undef, LDE,NMAX)
U = Array{Float64,2}(undef, LDU,NMAX)
V = Array{Float64,2}(undef, LDV,NMAX)
BETA = Array{Float64,1}(undef, NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
WI = Array{Float64,1}(undef, NMAX)
WR = Array{Float64,1}(undef, NMAX)
BWORK = Array{Bool,1}(undef, NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
NLOW = parse(BlasInt, vs[2])
NSUP = parse(BlasInt, vs[3])
ALPHA = parse(Float64, replace(vs[4],'D'=>'E'))
DICO = vs[5][1]
STDOM = vs[6][1]
JOBU = vs[7][1]
JOBV = vs[8][1]
if ( N<0 || N>NMAX )
@error "invalid N=$N"
else
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
E[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
# FOREIGN.dgges!( 'Vectors', 'Vectors', 'Not sorted', DELCTG, N, A, LDA, E, LDE, NDIM, WR, WI, BETA, U, LDU, V, LDV, DWORK, LDWORK, BWORK, INFO )
Aschur = schur(A[1:N,1:N], E[1:N,1:N])
WR[1:N] .= real.(Aschur.alpha)
WI[1:N] .= imag.(Aschur.alpha)
U[1:N,1:N] .= Aschur.Q
V[1:N,1:N] .= Aschur.Z
A[1:N,1:N] .= Aschur.S
E[1:N,1:N] .= Aschur.T
println(io, "orig T:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
println(io, "eigvals:")
show(io, "text/plain", (WR[1:N] .+ im*WI[1:N]) ./ BETA[1:N])
println(io)
# interp call 2
NDIM, INFO = SLICOT.mb03qg!(DICO, STDOM, JOBU, JOBV, N, NLOW, NSUP, ALPHA, A, E, U, V)
println(io, "NDIM = $NDIM")
@test INFO == 0
if ( INFO!=0 )
println(io, "INFO = $INFO")
return
end
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "E:")
_nc = N
_nr = N
show(io, "text/plain", E[1:_nr,1:_nc])
println(io)
# interp output 3
println(io, "U:")
_nc = N
_nr = N
show(io, "text/plain", U[1:_nr,1:_nc])
println(io)
# interp output 4
println(io, "V:")
_nc = N
_nr = N
show(io, "text/plain", V[1:_nr,1:_nc])
println(io)
end # if
close(f)
end # run_mb03qg()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1940 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03rd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 10
LDA = NMAX
LDX = NMAX
LDWORK = 3*NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
X = Array{Float64,2}(undef, LDX,NMAX)
BLSIZE = Array{BlasInt,1}(undef, NMAX)
WR = Array{Float64,1}(undef, NMAX)
WI = Array{Float64,1}(undef, NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
BWORK = Array{Bool,1}(undef, NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
PMAX = parse(Float64, replace(vs[2],'D'=>'E'))
TOL = parse(Float64, replace(vs[3],'D'=>'E'))
JOBX = vs[4][1]
SORT = vs[5][1]
if ( N<0 || N>NMAX )
@error "Invalid N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
#FOREIGN.dgees!( 'Vectors', 'Not sorted', SELECT, N, A, LDA, SDIM, WR, WI, X, LDX, DWORK, LDWORK, BWORK, INFO )
Aschur = schur(A[1:N,1:N])
A[1:N,1:N] .= Aschur.T
X[1:N,1:N] .= Aschur.Z
# interp call 2
NBLCKS, INFO = SLICOT.mb03rd!(JOBX, SORT, N, PMAX, A, X, BLSIZE, WR, WI, TOL)
println(io, "NBLCKS = $NBLCKS")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
@warn "mb03rd returns INFO=$INFO"
end
# interp output 1
println(io, "BLSIZE:")
_nr = NBLCKS
show(io, "text/plain", BLSIZE[1:_nr])
println(io)
# interp output 2
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 3
println(io, "X:")
_nc = N
_nr = N
show(io, "text/plain", X[1:_nr,1:_nc])
println(io)
close(f)
end # run_mb03rd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1737 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03sd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
LDA = NMAX
LDQG = NMAX
LDWORK = NMAX*( NMAX+1 )
A = Array{Float64,2}(undef, LDA,NMAX)
QG = Array{Float64,2}(undef, LDQG,NMAX+1)
WR = Array{Float64,1}(undef, NMAX)
WI = Array{Float64,1}(undef, NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
JOBSCL = vs[2][1]
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*(_jsz+1)÷2
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
_i0 = 0
for j in 1:_jsz
QG[j,j+1:_jsz+1] .= parsex.(Float64, vs[_i0+1:_i0+_jsz-j+1])
_i0 += _jsz-j+1
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*(_jsz+1)÷2
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
_i0 = 0
for j in 1:_jsz
QG[j:_jsz,j] .= parsex.(Float64, vs[_i0+1:_i0+_jsz-j+1])
_i0 += _jsz-j+1
end
close(f)
# interp call 1
INFO = SLICOT.mb03sd!(JOBSCL, N, A, QG, WR, WI, LDWORK)
@test INFO == 0
INFO != 0 && return
println(io, "eigvals:")
show(io, "text/plain", vcat(WR[1:N] + im*WI[1:N],
-WR[N:-1:1] - im*WI[N:-1:1]))
println(io)
end # run_mb03sd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3631 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03td(datfile, io=stdout)
ZERO = 0.0e0
NIN = 5
NOUT = 6
NMAX = 100
LDA = NMAX
LDG = NMAX
LDRES = NMAX
LDU1 = NMAX
LDU2 = NMAX
LDWORK = 8*NMAX
SELECT = Array{Bool,1}(undef, NMAX)
LOWER = Array{Bool,1}(undef, NMAX)
A = Array{Float64,2}(undef, LDA,NMAX)
G = Array{Float64,2}(undef, LDG,NMAX)
U1 = Array{Float64,2}(undef, LDU1,NMAX)
U2 = Array{Float64,2}(undef, LDU2,NMAX)
WR = Array{Float64,1}(undef, NMAX)
WI = Array{Float64,1}(undef, NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
RES = Array{Float64,2}(undef, LDRES,NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
TYP = vs[2][1]
COMPU = vs[3][1]
if ( N<=0 || N>NMAX )
else
vs = String[]
_isz = N
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
SELECT[1:_isz] .= parsex.(Bool, vs)
vs = String[]
_isz = N
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
LOWER[1:_isz] .= parsex.(Bool, vs)
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
G[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
if ( LSAME( COMPU, 'U' ) )
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
U1[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
U2[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end # if
# interp call 1
select = convert(Vector{BlasBool},SELECT)
lower = convert(Vector{BlasBool},LOWER)
M, INFO = SLICOT.mb03td!(TYP, COMPU, select, lower, N, A, G, U1, U2, WR, WI, LDWORK)
println(io, "M = $M")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( LSAME( COMPU, 'U' ) )
# interp output 1
println(io, "U1:")
_nc = N
_nr = N
show(io, "text/plain", U1[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "U2:")
_nc = N
_nr = N
show(io, "text/plain", U2[1:_nr,1:_nc])
println(io)
# unable to translate write statement:
# write MA02JD( .FALSE., .FALSE., N, U1, LDU1, U2, LDU2, RES, LDRES )
end # if
# interp output 3
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
Gfull = zeros(N,N)
if ( LSAME( TYP, 'S' ) )
# interp output 4
for i in 1:N
for j in 1:i-1
Gfull[i,j] = -G[j,i]
end
for j in i+1:N
Gfull[i,j] = G[i,j]
end
end
else
for i in 1:N
for j in 1:i-1
Gfull[i,j] = G[j,i]
end
for j in i:N
Gfull[i,j] = G[i,j]
end
end
end # if
println(io, "G:")
_nc = N
_nr = N
show(io, "text/plain", Gfull[1:_nr,1:_nc])
println(io)
end # if
end # if
close(f)
end # run_mb03td()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1484 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03ud(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 10
LDA = NMAX
LDQ = NMAX
LDWORK = max( 1, 5*NMAX )
A = Array{Float64,2}(undef, LDA,NMAX)
Q = Array{Float64,2}(undef, LDQ,NMAX)
SV = Array{Float64,1}(undef, NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
JOBQ = vs[2][1]
JOBP = vs[3][1]
if ( N<0 || N>NMAX )
else
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
INFO = SLICOT.mb03ud!(JOBQ, JOBP, N, A, Q, SV)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
# interp output 1
println(io,"SV:")
_nr = N
show(io,"text/plain",SV[1:_nr])
println(io,)
if ( LSAME( JOBP, 'V' ) )
# interp output 2
println(io,"A:")
_nc = N
_nr = N
show(io,"text/plain",A[1:_nr,1:_nc])
println(io,)
end # if
if ( LSAME( JOBQ, 'V' ) )
# interp output 3
println(io,"Q:")
_nc = N
_nr = N
show(io,"text/plain",Q[1:_nr,1:_nc])
println(io,)
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3112 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03vd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
PMAX = 20
LDA1 = NMAX
LDA2 = NMAX
LDQ1 = NMAX
LDQ2 = NMAX
LDTAU = NMAX-1
LDWORK = NMAX
ZERO = 0.0e0
ONE = 1.0e0
A = Array{Float64,3}(undef, LDA1,LDA2,PMAX)
TAU = Array{Float64,2}(undef, LDTAU,PMAX)
Q = Array{Float64,3}(undef, LDQ1,LDQ2,PMAX)
AS = Array{Float64,3}(undef, LDA1,LDA2,PMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
QTA = Array{Float64,2}(undef, LDQ1,NMAX)
SSQ = 0.0
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
P = parse(BlasInt, vs[2])
ILO = parse(BlasInt, vs[3])
IHI = parse(BlasInt, vs[4])
if ( N<0 || N>min( LDA1, LDA2 ) )
@error "illegal N=$N"
end
if ( P<=0 || P>PMAX )
@error "illegal P=$P"
end
_isz,_jsz,_ksz = (N,N,P)
for k in 1:_ksz
vs = String[]
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz,k] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end
# interp call 1
#FOREIGN.dlacpy!( 'F', N, N, A(1,1,K), LDA1, AS(1,1,K), LDA1 )
AS = copy(A)
# interp call 2
INFO = SLICOT.mb03vd!(N, P, ILO, IHI, A, TAU)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
@warn "mb03vd returns info=$INFO"
end
# interp call 3
for K in 1:P
# FOREIGN.dlacpy!( 'L', N, N, A(1,1,K), LDA1, Q(1,1,K), LDQ1 )
Q[1:N,1:N,K] .= tril(A[1:N,1:N,K])
if ( N>1 )
if ( N>2 && K==1 )
# interp call 4
# FOREIGN.dlaset!( 'L', N-2, N-2, ZERO, ZERO, A(3,1,K), LDA1 )
triu!(view(A,1:N,1:N,K),-1)
elseif ( K>1 )
# interp call 5
# FOREIGN.dlaset!( 'L', N-1, N-1, ZERO, ZERO, A(2,1,K), LDA1 )
triu!(view(A,1:N,1:N,K))
end # if
end # if
end # for K
println(io, "A:")
_nc = N
_nr = N
_nk = P
show(io, "text/plain", A[1:_nr,1:_nc,1:_nk])
println(io)
# interp call 6
INFO = SLICOT.mb03vy!(N, P, ILO, IHI, Q, TAU)
@test INFO == 0
INFO == 0 || return
println(io, "Q:")
_nc = N
_nr = N
_nk = P
show(io, "text/plain", Q[1:_nr,1:_nc,1:_nk])
println(io)
if ( INFO!=0 )
@warn "mb03vy returns info=$INFO"
else
SSQ = ZERO
for K in 1:P
KP1 = mod(K,P)+1
# interp call 7
#FOREIGN.dgemm!( 'T', 'N', N, N, N, ONE, Q(1,1,K), LDQ1, AS(1,1,K), LDA1, ZERO, QTA, LDQ1 )
qta = Q[1:N,1:N,K]' * AS[1:N,1:N,K]
# interp call 8
#FOREIGN.dgemm!( 'N', 'N', N, N, N, ONE, QTA, LDQ1, Q(1,1,KP1), LDQ1, -ONE, A(1,1,K), LDA1 )
mul!(view(A,1:N,1:N,K),qta,view(Q,1:N,1:N,KP1),1,-1)
#SSQ = DLAPY2( SSQ, DLANGE( 'Frobenius', N, N, A(1,1,K), LDA1, DWORK ) )
SSQ = hypot(SSQ, norm(view(A,1:N,1:N,K)))
end
println(io, "norm(Q'*A*Q - Aout) = ", SSQ)
end
close(f)
end # run_mb03vd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3698 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03wd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
PMAX = 20
LDA1 = NMAX
LDA2 = NMAX
LDTAU = NMAX-1
LDZ1 = NMAX
LDZ2 = NMAX
LDZTA = NMAX
LDWORK = max( NMAX, NMAX + PMAX - 2 )
ZERO = 0.0e0
ONE = 1.0e0
A = Array{Float64,3}(undef, LDA1,LDA2,PMAX)
TAU = Array{Float64,2}(undef, LDTAU,PMAX)
Z = Array{Float64,3}(undef, LDZ1,LDZ2,PMAX)
WR = Array{Float64,1}(undef, NMAX)
WI = Array{Float64,1}(undef, NMAX)
AS = Array{Float64,3}(undef, LDA1,LDA2,PMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
ZTA = Array{Float64,2}(undef, LDZTA,NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
P = parse(BlasInt, vs[2])
ILO = parse(BlasInt, vs[3])
IHI = parse(BlasInt, vs[4])
ILOZ = parse(BlasInt, vs[5])
IHIZ = parse(BlasInt, vs[6])
JOB = vs[7][1]
COMPZ = vs[8][1]
if ( N<0 || N>min( LDA1, LDA2 ) )
@error "Illegal N=$N"
end
if ( P<=0 || P>PMAX )
@error "Illegal P=$P"
end
_isz,_jsz,_ksz = (N,N,P)
for k in 1:_ksz
vs = String[]
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz,k] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end
close(f)
# interp call 1
#FOREIGN.dlacpy!( 'F', N, N, A(1,1,K), LDA1, AS(1,1,K), LDA1 )
AS[1:N,1:N,1:P] .= A[1:N,1:N,1:P]
# interp call 2
INFO = SLICOT.mb03vd!(N, P, ILO, IHI, A, TAU)
if ( INFO!=0 )
@warn "mb03vd returns info=$INFO"
return
end
if ( LSAME( COMPZ, 'V' ) )
# interp call 3
#FOREIGN.dlacpy!( 'L', N, N, A(1,1,K), LDA1, Z(1,1,K), LDZ1 )
for k in 1:P
Z[1:N,1:N,k] .= tril(A[1:N,1:N,k])
end
# interp call 4
INFO = SLICOT.mb03vy!(N, P, ILO, IHI, Z, TAU)
@test INFO == 0
INFO == 0 || return
if ( INFO > 0 )
@error "mb03vy returns info=$INFO"
end
# deviate from source here; continue even if COMPZ != 'V'
end
# interp call 5
INFO = SLICOT.mb03wd!(JOB, COMPZ, N, P, ILO, IHI, ILOZ, IHIZ, A, Z, WR, WI, LDWORK)
if ( INFO > 0 )
@warn "mb03wd returns info=$INFO"
println(io, "valid eigvals:")
imin = max(ILO, INFO+1)
show(io, "text/plain", WR[imin:N] + im * WI[imin:N])
println(io)
end # if
# interp call 6
INFO = SLICOT.mb03wx!(ILO-1, P, A, WR, WI)
if IHI<N
# interp call 7
INFO = SLICOT.mb03wx!(N-IHI, P, view(A,IHI+1:N, IHI+1:N, 1:P))
end
# unable to translate write statement:
# in do block [('40', 'I', 'N')]
# write WR(I), WI(I)
# interp output 1
println(io, "A:")
_nc = N
_nr = N
_nk = P
show(io, "text/plain", A[1:_nr,1:_nc,1:_nk])
println(io)
# interp output 2
println(io, "Z:")
_nc = N
_nr = N
_nk = P
show(io, "text/plain", Z[1:_nr,1:_nc,1:_nk])
println(io)
SSQ = ZERO
for K in 1:P
KP1 = mod(K,P) + 1
# interp call 8
# FOREIGN.dgemm!( 'T', 'N', N, N, N, ONE, Z(1,1,K), LDZ1, AS(1,1,K), LDA1, ZERO, ZTA, LDZTA )
zta = Z[1:N,1:N,K]' * AS[1:N,1:N,K]
# interp call 9
# FOREIGN.dgemm!( 'N', 'N', N, N, N, ONE, ZTA, LDZTA, Z(1,1,KP1), LDZ1, -ONE, A(1,1,K), LDA1 )
A[1:N,1:N,K] .-= zta * Z[1:N,1:N,KP1]
# SSQ = DLAPY2( SSQ, DLANGE( 'Frobenius', N, N, A(1,1,K), LDA1, DWORK ) )
SSQ = hypot(SSQ, norm(A[1:N,1:N,K]))
end
println(io, "decomposition residual: ",SSQ)
end # run_mb03wd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 7561 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03xd(datfile, io=stdout)
ZERO = 0.0e0
ONE = 1.0e0
NIN = 5
NOUT = 6
NMAX = 100
LDA = NMAX
LDQG = NMAX
LDRES = NMAX
LDT = NMAX
LDU1 = NMAX
LDU2 = NMAX
LDV1 = NMAX
LDV2 = NMAX
LDWORK = 3*NMAX*NMAX + 7*NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
QG = Array{Float64,2}(undef, LDQG,NMAX+1)
T = Array{Float64,2}(undef, LDT,NMAX)
U1 = Array{Float64,2}(undef, LDU1,NMAX)
U2 = Array{Float64,2}(undef, LDU2,NMAX)
V1 = Array{Float64,2}(undef, LDV1,NMAX)
V2 = Array{Float64,2}(undef, LDV2,NMAX)
WR = Array{Float64,1}(undef, NMAX)
WI = Array{Float64,1}(undef, NMAX)
SCALE = Array{Float64,1}(undef, NMAX)
RES = Array{Float64,2}(undef, LDRES,3*NMAX+1)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
BALANC = vs[2][1]
JOB = vs[3][1]
JOBU = vs[4][1]
JOBV = vs[5][1]
if ( N<=0 || N>NMAX )
@error "illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
# FOREIGN.dlacpy!( 'All', N, N, A, LDA, RES(1,N+1), LDRES )
RES[1:N,N+1:2*N] .= A[1:N,1:N]
vs = String[]
_isz,_jsz = (N,N+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
QG[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 2
#FOREIGN.dlacpy!( 'All', N, N+1, QG, LDQG, RES(1,2*N+1), LDRES )
RES[1:N,2*N+1:3*N+1] .= QG[1:N,1:N+1]
# interp call 3
ILO, INFO = SLICOT.mb03xd!(BALANC, JOB, JOBU, JOBV, N, A, QG, T, U1, U2, V1, V2, WR, WI, SCALE)
println(io, "ILO = $ILO")
@test INFO == 0
INFO == 0 || return
if ( LSAME( JOB, 'S' )||LSAME( JOB, 'G' ) )
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "T:")
_nc = N
_nr = N
show(io, "text/plain", T[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( JOB, 'G' ) )
println(io, "QG:")
show(io, "text/plain", QG[1:N,2:N+1])
println(io)
end # if
if ( LSAME( JOB, 'G' )&&LSAME( JOBU, 'U' )&& LSAME( JOBV, 'V' ) )
# interp call 4
ILO, INFO = SLICOT.mb04dd!(BALANC, N, view(RES,1:N,N+1:2*N),
view(RES,1:N,2*N+1:3*N), DWORK)
# interp call 5
# FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, RES(1,N+1), LDRES, V1, LDV1, ZERO, RES, LDRES )
RES[1:N,1:N] .= RES[1:N,N+1:2*N] * V1[1:N,1:N]
# interp call 6
#FOREIGN.dsymm!( 'Left', 'Upper', N, N, -ONE, RES(1,2*N+2), LDRES, V2, LDV2, ONE, RES, LDRES )
BLAS.symm!('L','U',-ONE,view(RES,1:N,2*N+2:3*N+1),view(V2,1:N,1:N),ONE,view(RES,1:N,1:N))
# interp call 7
# FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, -ONE, U1, LDU1, T, LDT, ONE, RES, LDRES )
BLAS.gemm!('N','N',-ONE,U1[1:N,1:N],T[1:N,1:N],ONE,view(RES,1:N,1:N))
# TEMP = DLANGE( 'Frobenius', N, N, RES, LDRES, DWORK )
TEMP = norm(RES[1:N,1:N])
# interp call 8
# FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, RES(1,N+1), LDRES, V2, LDV2, ZERO, RES, LDRES )
BLAS.gemm!('N','N',ONE,RES[1:N,N+1:2*N],V2[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 9
#FOREIGN.dsymm!( 'Left', 'Upper', N, N, ONE, RES(1,2*N+2), LDRES, V1, LDV1, ONE, RES, LDRES )
BLAS.symm!('L','U',ONE,RES[1:N,2*N+2:3*N+1],V1[1:N,1:N],ONE,view(RES,1:N,1:N))
# interp call 10
# FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, -ONE, U1, LDU1, QG(1,2), LDQG, ONE, RES, LDRES )
BLAS.gemm!('N','N',-ONE,U1[1:N,1:N],QG[1:N,2:N+1],ONE,view(RES,1:N,1:N))
# interp call 11
# FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, -ONE, U2, LDU2, A, LDA, ONE, RES, LDRES )
BLAS.gemm!('N','T',-ONE,U2[1:N,1:N],A[1:N,1:N],ONE,view(RES,1:N,1:N))
# TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES, LDRES, DWORK ) )
TEMP = hypot(TEMP, norm(RES[1:N,1:N]))
# interp call 12
# FOREIGN.dsymm!( 'Left', 'Lower', N, N, ONE, RES(1,2*N+1), LDRES, V1, LDV1, ZERO, RES, LDRES )
BLAS.symm!('L','L',ONE,RES[1:N,2*N+1:3*N],V1[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 13
# FOREIGN.dgemm!( 'Transpose', 'No Transpose', N, N, N, ONE, RES(1,N+1), LDRES, V2, LDV2, ONE, RES, LDRES )
BLAS.gemm!('T','N',ONE,RES[1:N,N+1:2*N],V2[1:N,1:N],ONE,view(RES,1:N,1:N))
# interp call 14
# FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, U2, LDU2, T, LDT, ONE, RES, LDRES )
BLAS.gemm!('N','N',ONE,U2[1:N,1:N],T[1:N,1:N],ONE,view(RES,1:N,1:N))
# TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES, LDRES, DWORK ) )
TEMP = hypot(TEMP, norm(RES[1:N,1:N]))
# interp call 15
# FOREIGN.dsymm!( 'Left', 'Lower', N, N, ONE, RES(1,2*N+1), LDRES, V2, LDV2, ZERO, RES, LDRES )
BLAS.symm!('L','L',ONE,RES[1:N,2*N+1:3*N],V2[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 16
# FOREIGN.dgemm!( 'Transpose', 'No Transpose', N, N, N, -ONE, RES(1,N+1), LDRES, V1, LDV1, ONE, RES, LDRES )
BLAS.gemm!('T','N',-ONE,RES[1:N,N+1:2*N],V1[1:N,1:N],ONE,view(RES,1:N,1:N))
# interp call 17
# FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, U2, LDU2, QG(1,2), LDQG, ONE, RES, LDRES )
BLAS.gemm!('N','N',ONE,U2[1:N,1:N],QG[1:N,2:N+1],ONE,view(RES,1:N,1:N))
# interp call 18
# FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, -ONE, U1, LDU1, A, LDA, ONE, RES, LDRES )
BLAS.gemm!('N','T',-ONE,U1[1:N,1:N],A[1:N,1:N],ONE,view(RES,1:N,1:N))
# TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES, LDRES, DWORK ) )
TEMP = hypot(TEMP, norm(RES[1:N,1:N]))
println(io, "decomposition residual norm = $TEMP")
end # if
if ( LSAME( JOBU, 'U' ) )
# interp output 4
println(io, "U1:")
_nc = N
_nr = N
show(io, "text/plain", U1[1:_nr,1:_nc])
println(io)
println(io, "U2:")
_nc = N
_nr = N
show(io, "text/plain", U2[1:_nr,1:_nc])
println(io)
# unable to translate write statement:
# write MA02JD( .FALSE., .FALSE., N, U1, LDU1, U2, LDU2, RES, LDRES )
resid = SLICOT.ma02jd!(false,false,N,U1,U2)
println(io, "U residual norm = $resid")
end # if
if ( LSAME( JOBV, 'V' ) )
# interp output 5
println(io, "V1:")
_nc = N
_nr = N
show(io, "text/plain", V1[1:_nr,1:_nc])
println(io)
println(io, "V2:")
_nc = N
_nr = N
show(io, "text/plain", V2[1:_nr,1:_nc])
println(io)
# unable to translate write statement:
# write MA02JD( .FALSE., .FALSE., N, V1, LDV1, V2, LDV2, RES, LDRES )
resid = SLICOT.ma02jd!(false,false,N,V1,V2)
println(io, "V residual norm = $resid")
end # if
if ( LSAME( BALANC, 'S' )||LSAME( BALANC, 'B' ) )
println(io, "SCALE:")
show(io, "text/plain", SCALE[1:N])
println(io)
end # if
end # run_mb03xd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 4226 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03xp(datfile, io=stdout)
ZERO = 0.0e0
ONE = 1.0e0
NIN = 5
NOUT = 6
NMAX = 200
LDA = NMAX
LDB = NMAX
LDQ = NMAX
LDRES = NMAX
LDWORK = NMAX
LDZ = NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
B = Array{Float64,2}(undef, LDA,NMAX)
Q = Array{Float64,2}(undef, LDQ,NMAX)
Z = Array{Float64,2}(undef, LDZ,NMAX)
ALPHAR = Array{Float64,1}(undef, NMAX)
ALPHAI = Array{Float64,1}(undef, NMAX)
BETA = Array{Float64,1}(undef, NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
RES = Array{Float64,2}(undef, LDRES,3*NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
ILO = parse(BlasInt, vs[2])
IHI = parse(BlasInt, vs[3])
if ( N<=0 || N>NMAX )
@error "illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
#FOREIGN.dlacpy!( 'All', N, N, A, LDA, RES(1,N+1), LDRES )
RES[1:N,N+1:2N] .= A[1:N,1:N]
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 2
#FOREIGN.dlacpy!( 'All', N, N, B, LDB, RES(1,2*N+1), LDRES )
RES[1:N,2*N+1:3N] .= B[1:N,1:N]
# interp call 3
INFO = SLICOT.mb03xp!('S', 'I', 'I', N, ILO, IHI, A, B, Q, Z, ALPHAR, ALPHAI, BETA, LDWORK)
@test INFO == 0
INFO == 0 || return
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp call 4
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, RES(1,N+1), LDRES, Z, LDZ, ZERO, RES, LDRES )
BLAS.gemm!('N','N',ONE,RES[1:N,N+1:2N],Z[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 5
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, -ONE, Q, LDQ, A, LDA, ONE, RES, LDRES )
BLAS.gemm!('N','N',-ONE,Q[1:N,1:N],A[1:N,1:N],ONE,view(RES,1:N,1:N))
resid = norm(RES[1:N,1:N])
println(io, "Frobenius norm of A Z - Q S: $resid")
@test resid < 1e-12
println(io, "B:")
_nc = N
_nr = N
show(io, "text/plain", B[1:_nr,1:_nc])
println(io)
# interp call 6
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, RES(1,2*N+1), LDRES, Q, LDQ, ZERO, RES, LDRES )
BLAS.gemm!('N','N',ONE,RES[1:N,2*N+1:3N],Q[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 7
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, -ONE, Z, LDZ, B, LDB, ONE, RES, LDRES )
BLAS.gemm!('N','N',-ONE,Z[1:N,1:N],B[1:N,1:N],ONE,view(RES,1:N,1:N))
resid = norm(RES[1:N,1:N])
println(io, "Frobenius norm of B Q - Z T: $resid")
@test resid < 1e-12
println(io, "Q:")
_nc = N
_nr = N
show(io, "text/plain", Q[1:_nr,1:_nc])
println(io)
# interp call 8
#FOREIGN.dgemm!( 'Transpose', 'No Transpose', N, N, N, ONE, Q, LDQ, Q, LDQ, ONE, RES, LDRES )
BLAS.gemm!('T','N',ONE,Q[1:N,1:N],Q[1:N,1:N],ZERO,view(RES,1:N,1:N))
resid = norm(RES[1:N,1:N] - I)
println(io, "orth. residual norm of Q: $resid")# interp output 4
@test resid < 1e-12
println(io, "Z:")
_nc = N
_nr = N
show(io, "text/plain", Z[1:_nr,1:_nc])
println(io)
# interp call 9
#FOREIGN.dgemm!( 'Transpose', 'No Transpose', N, N, N, ONE, Z, LDZ, Z, LDZ, ONE, RES, LDRES )
BLAS.gemm!('T','N',ONE,Z[1:N,1:N],Z[1:N,1:N],ZERO,view(RES,1:N,1:N))
resid = norm(RES[1:N,1:N] - I)
println(io, "orth. residual norm of Z: $resid")# unable to translate write statement:
@test resid < 1e-12
# in do block [('70', 'I', 'N')]
# write ALPHAR(I), ALPHAI(I), BETA(I)
println(io, "ALPHA:")
show(io, "text/plain", ALPHAR[1:N]+im*ALPHAI[1:N])
println(io)
println(io, "BETA:")
show(io, "text/plain", BETA[1:N])
println(io)
end # run_mb03xp()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 8401 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03xz(datfile, io=stdout)
ZER = 0.0e0
ZERO = 0.0+0.0im
ONE = 1.0+0.0im
NIN = 5
NOUT = 6
NMAX = 100
LDA = 2*NMAX
LDAE = 2*NMAX
LDAS = NMAX
LDGE = 2*NMAX
LDQG = 2*NMAX
LDQGE = 2*NMAX
LDQGS = NMAX
LDRES = 2*NMAX
LDU1 = 2*NMAX
LDU2 = 2*NMAX
LDWORK = 20*NMAX*NMAX + 12*NMAX + 2
LZWORK = 12*NMAX - 2
A = Array{ComplexF64,2}(undef, LDA,2*NMAX)
QG = Array{ComplexF64,2}(undef, LDQG,2*NMAX+1)
U1 = Array{ComplexF64,2}(undef, LDU1,2*NMAX)
U2 = Array{ComplexF64,2}(undef, LDU2,2*NMAX)
WR = Array{Float64,1}(undef, 2*NMAX)
WI = Array{Float64,1}(undef, 2*NMAX)
SCALE = Array{Float64,1}(undef, NMAX)
BWORK = Array{BlasBool,1}(undef, 2*NMAX)
AS = Array{ComplexF64,2}(undef, LDAS,NMAX)
QGS = Array{ComplexF64,2}(undef, LDQGS,NMAX+1)
DWORK = Array{Float64,1}(undef, LDWORK)
QGE = Array{ComplexF64,2}(undef, LDQGE,2*NMAX+1)
GE = Array{ComplexF64,2}(undef, LDGE,2*NMAX)
AE = Array{ComplexF64,2}(undef, LDAE,2*NMAX)
RES = Array{ComplexF64,2}(undef, LDRES,2*NMAX)
ZWORK = Array{ComplexF64,1}(undef, LZWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
BALANC = vs[2][1]
JOB = vs[3][1]
JOBU = vs[4][1]
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
end
M = 2*N
A[1:M,1:M] .= ZERO
QG[1:M,1:2M] .= ZERO
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
AS[1:N,1:N] .= A[1:N,1:N]
vs = String[]
_isz,_jsz = (N,N+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
QG[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
#FOREIGN.zlacpy!( 'All', N, N+1, QG, LDQG, QGS, LDQGS )
QGS[1:N,1:N+1] .= QG[1:N,1:N+1]
# interp call 2
ILO, INFO = SLICOT.mb03xz!(BALANC, JOB, JOBU, N, A, QG, U1, U2, WR, WI, SCALE, BWORK)
println(io, "ILO = $ILO")
@test INFO == 0
INFO == 0 || return
println(io, "eigvals:")
show(io, "text/plain", WR[1:M] + im*WI[1:M])
println(io)
if ( LSAME( JOB, 'S' )||LSAME( JOB, 'G' ) )
# interp output 1
println(io, "A:")
_nc = M
_nr = M
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( JOB, 'G' ) )
# interp output 2
println(io, "QG:")
_nc = M
_nr = M
show(io, "text/plain", QG[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( JOB, 'G' )&&LSAME( JOBU, 'U' ) )
# interp call 3
ILO, INFO = SLICOT.mb04dz!(BALANC, N, AS, QGS, DWORK)
println(io, "ILO = $ILO")
@test INFO == 0
INFO == 0 || return
# interp call 4
#FOREIGN.zlaset!( 'Lower', M-1, M-1, ZERO, ZERO, A(2,1), LDA )
triu!(view(A,1:M,1:M-1))
# interp call 5
SLICOT.ma02ez!('U', 'C', 'N', M, QG)
# compute Ae,Ge,Qe
AE[1:N,1:N] .= im * imag.(AS[1:N,1:N])
AE[N+1:2N,1:N] .= -im * real.(AS[1:N,1:N])
for j in 1:N
AE[1:N,j+N] .= -AE[N+1:2N,j]
AE[N+1:2N,j+N] .= AE[1:N,j]
end
QGE[1:N,1:N+1] .= im * imag.(QGS[1:N,1:N+1])
for j in 1:N+1
QGE[N+j:2N,j] .= -im * real.(QGS[j:N,j])
end
for j in 1:N
QGE[1:j,j+N+1] .= -QGE[1:j,j+1]
QGE[N+1:2N,j+N+1] .= QGE[1:N,j+1]
end
QGE[N+1:2N,N+1] .= QGE[1:N,1]
# interp call 7
SLICOT.ma02ez!('L', 'T', 'N', N, view(QGE,N+1:2N,1:N+1))
# interp call 8
SLICOT.ma02ez!('U', 'T', 'N', N, view(QGE,1:N,N+2:2N+2))
# interp call 9
# FOREIGN.zlacpy!( 'Upper', M, M, QGE(1,2), LDQGE, GE, LDGE )
GE[1:M,1:M] .= triu(QGE[1:M,2:M+1])
# interp call 10
SLICOT.ma02ez!('U', 'T', 'S', M, GE)
# interp call 11
SLICOT.ma02ez!('L', 'T', 'S', M, QGE)
# interp call 12
# FOREIGN.zgemm!( 'No Transpose', 'No Transpose', M, M, M, ONE, AE, LDAE, U1, LDU1, ZERO, RES, LDRES )
BLAS.gemm!('N','N',true,AE[1:M,1:M],U1[1:M,1:M],false,view(RES,1:M,1:M))
# interp call 13
# FOREIGN.zgemm!( 'No Transpose', 'No Transpose', M, M, M, -ONE, GE, LDGE, U2, LDU2, ONE, RES, LDRES )
BLAS.gemm!('N','N',-ONE,GE[1:M,1:M],U2[1:M,1:M],true,view(RES,1:M,1:M))
# interp call 14
# FOREIGN.zgemm!( 'No Transpose', 'No Transpose', M, M, M, -ONE, U1, LDU1, A, LDA, ONE, RES, LDRES )
BLAS.gemm!('N','N',-ONE,U1[1:M,1:M],A[1:M,1:M],true,view(RES,1:M,1:M))
# TEMP = ZLANGE( 'Frobenius', M, M, RES, LDRES, DWORK )
TEMP = norm(RES[1:M,1:M])
# interp call 15
#FOREIGN.zgemm!( 'No Transpose', 'No Transpose', M, M, M, ONE, AE, LDAE, U2, LDU2, ZERO, RES, LDRES )
BLAS.gemm!('N','N',true,AE[1:M,1:M],U2[1:M,1:M],false,view(RES,1:M,1:M))
# interp call 16
# FOREIGN.zgemm!( 'No Transpose', 'No Transpose', M, M, M, ONE, GE, LDGE, U1, LDU1, ONE, RES, LDRES )
BLAS.gemm!('N','N',true,GE[1:M,1:M],U1[1:M,1:M],true,view(RES,1:M,1:M))
# interp call 17
# FOREIGN.zgemm!( 'No Transpose', 'No Transpose', M, M, M, -ONE, U1, LDU1, QG, LDQG, ONE, RES, LDRES )
BLAS.gemm!('N','N',-ONE,U1[1:M,1:M],QG[1:M,1:M],true,view(RES,1:M,1:M))
# interp call 18
# FOREIGN.zgemm!( 'No Transpose', 'Conj Transpose', M, M, M, ONE, U2, LDU2, A, LDA, ONE, RES, LDRES )
BLAS.gemm!('N','C',true,U2[1:M,1:M],A[1:M,1:M],true,view(RES,1:M,1:M))
# TEMP = DLAPY2( TEMP, ZLANGE( 'Frobenius', M, M, RES, LDRES, DWORK ) )
TEMP = hypot(TEMP,norm(RES[1:M,1:M]))
# interp call 19
# FOREIGN.zgemm!( 'No Transpose', 'No Transpose', M, M, M, true, QGE, LDQGE, U1, LDU1, ZERO, RES, LDRES )
BLAS.gemm!('N','N',true,QGE[1:M,1:M],U1[1:M,1:M],false,view(RES,1:M,1:M))
# interp call 20
# FOREIGN.zgemm!( 'Transpose', 'No Transpose', M, M, M, -ONE, AE, LDAE, U2, LDU2, ONE, RES, LDRES )
BLAS.gemm!('T','N',-ONE,AE[1:M,1:M],U2[1:M,1:M],true,view(RES,1:M,1:M))
# interp call 21
# FOREIGN.zgemm!( 'No Transpose', 'No Transpose', M, M, M, ONE, U2, LDU2, A, LDA, ONE, RES, LDRES )
BLAS.gemm!('N','N',true,U2[1:M,1:M],A[1:M,1:M],true,view(RES,1:M,1:M))
# TEMP = DLAPY2( TEMP, ZLANGE( 'Frobenius', M, M, RES, LDRES, DWORK ) )
TEMP = hypot(TEMP,norm(RES[1:M,1:M]))
# interp call 22
# FOREIGN.zgemm!( 'No Transpose', 'No Transpose', M, M, M, ONE, QGE, LDQGE, U2, LDU2, ZERO, RES, LDRES )
BLAS.gemm!('N','N',true,QGE[1:M,1:M],U2[1:M,1:M],false,view(RES,1:M,1:M))
# interp call 23
# FOREIGN.zgemm!( 'Transpose', 'No Transpose', M, M, M, ONE, AE, LDAE, U1, LDU1, ONE, RES, LDRES )
BLAS.gemm!('T','N',true,AE[1:M,1:M],U1[1:M,1:M],true,view(RES,1:M,1:M))
# interp call 24
# FOREIGN.zgemm!( 'No Transpose', 'No Transpose', M, M, M, ONE, U2, LDU2, QG, LDQG, ONE, RES, LDRES )
BLAS.gemm!('N','N',true,U2[1:M,1:M],QG[1:M,1:M],true,view(RES,1:M,1:M))
# interp call 25
# FOREIGN.zgemm!( 'No Transpose', 'Conj Transpose', M, M, M, ONE, U1, LDU1, A, LDA, ONE, RES, LDRES )
BLAS.gemm!('N','C',true,U1[1:M,1:M],A[1:M,1:M],true,view(RES,1:M,1:M))
#TEMP = DLAPY2( TEMP, ZLANGE( 'Frobenius', M, M, RES, LDRES, DWORK ) )
TEMP = hypot(TEMP,norm(RES[1:M,1:M]))
println(io, "residual norm = $TEMP")
end # if
if ( !LSAME( JOB, 'E' )&&LSAME( JOBU, 'U' ) )
# interp output 3
println(io, "U1:")
_nc = M
_nr = M
show(io, "text/plain", U1[1:_nr,1:_nc])
println(io)
println(io, "U2:")
_nc = M
_nr = M
show(io, "text/plain", U1[2:_nr,1:_nc])
println(io)
# unable to translate write statement:
# write MA02JZ( .FALSE., .FALSE., M, U1, LDU1, U2, LDU2, RES, LDRES )
resid = SLICOT.ma02jz!(false,false,M,U1,U2)
println(io, "U residual = $resid")
end # if
if ( LSAME( BALANC, 'S' )||LSAME( BALANC, 'B' ) )
println(io, "SCALE:")
show(io, "text/plain", SCALE[1:N])
println(io)
end # if
end # run_mb03xz()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 6580 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb03zd(datfile, io=stdout)
ZERO = 0.0e0
ONE = 1.0e0
NIN = 5
NOUT = 6
NMAX = 200
LDG = NMAX
LDRES = 2*NMAX
LDS = NMAX
LDT = NMAX
LDU1 = NMAX
LDU2 = NMAX
LDUS = 2*NMAX
LDUU = 2*NMAX
LDV1 = NMAX
LDV2 = NMAX
LDWORK = 3*NMAX*NMAX + 7*NMAX
SELECT = Array{BlasBool,1}(undef, NMAX)
SCALE = Array{Float64,1}(undef, NMAX)
S = Array{Float64,2}(undef, LDS,NMAX)
T = Array{Float64,2}(undef, LDT,NMAX)
G = Array{Float64,2}(undef, LDG,NMAX)
U1 = Array{Float64,2}(undef, LDU1,NMAX)
U2 = Array{Float64,2}(undef, LDU2,NMAX)
V1 = Array{Float64,2}(undef, LDV1,NMAX)
V2 = Array{Float64,2}(undef, LDV2,NMAX)
WR = Array{Float64,1}(undef, NMAX)
WI = Array{Float64,1}(undef, NMAX)
US = Array{Float64,2}(undef, LDUS,2*NMAX)
UU = Array{Float64,2}(undef, LDUU,2*NMAX)
IWORK = Array{BlasInt,1}(undef, 2*NMAX)
LWORK = Array{BlasBool,1}(undef, 2*NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
RES = Array{Float64,2}(undef, LDRES,NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
ILO = parse(BlasInt, vs[2])
WHICH = vs[3][1]
METH = vs[4][1]
STAB = vs[5][1]
BALANC = vs[6][1]
ORTBAL = vs[7][1]
if ( N<=0 || N>NMAX )
@error "illegal N=$N"
end
if LSAME(WHICH,'S')
vs = String[]
_isz = N
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
SELECT[1:_isz] .= parsex.(Bool, vs[1:_isz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
S[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
T[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
if LSAME(WHICH,'A') && LSAME(METH,'L')
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
G[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end
if LSAME(BALANC,'P') || LSAME(BALANC,'S') || LSAME(BALANC,'B')
vs = String[]
_isz = N
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
SCALE[1:_isz] .= parsex.(Float64, vs[1:_isz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
U1[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
U2[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
V1[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
V2[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
M, INFO = SLICOT.mb03zd!(WHICH, METH, STAB, BALANC, ORTBAL, SELECT, N, 2*N, ILO, SCALE, S, T, G, U1, U2, V1, V2, WR, WI, US, UU, IWORK)
println(io, "M = $M")
@test INFO == 0
INFO == 0 || return
println(io, "eigvals:")
show(io, "text/plain", WR[1:N] + im *WI[1:N])
println(io)
if ( LSAME( STAB, 'S' )||LSAME( STAB, 'B' ) )
# interp output 1
println(io, "US:")
_nc = M
_nr = 2*N
show(io, "text/plain", US[1:_nr,1:_nc])
println(io)
if ( LSAME( ORTBAL, 'B' )||LSAME( BALANC, 'N' )|| LSAME( BALANC, 'P' ) )
# interp call 2
# FOREIGN.dgemm!( 'Transpose', 'No Transpose', M, M, 2*N, ONE, US, LDUS, US, LDUS, ZERO, RES, LDRES )
BLAS.gemm!('T','N',ONE,US[1:2N,1:M],US[1:2N,1:M],ZERO,view(RES,1:M,1:M))
resid = norm(RES[1:M,1:M] - I)
@test resid < 1e-12
println(io, "orth. resid norm of US: $resid")
end # if
# interp call 3
# FOREIGN.dgemm!( 'Transpose', 'No Transpose', M, M, N, ONE, US, LDUS, US(N+1,1), LDUS, ZERO, RES, LDRES )
BLAS.gemm!('T','N',ONE,US[1:N,1:M],US[N+1:2N,1:M],ZERO,view(RES,1:M,1:M))
# interp call 4
# FOREIGN.dgemm!( 'Transpose', 'No Transpose', M, M, N, -ONE, US(N+1,1), LDUS, US, LDUS, ONE, RES, LDRES )
BLAS.gemm!('T','N',-ONE,US[N+1:2N,1:M],US[1:N,1:M],ONE,view(RES,1:M,1:M))
resid = norm(RES[1:M,1:M])
@test resid < 1e-12
println(io, "sympl. resid norm of US: $resid")
end
if ( LSAME( STAB, 'U' )||LSAME( STAB, 'B' ) )
# interp output 2
println(io, "UU:")
_nc = M
_nr = 2*N
show(io, "text/plain", UU[1:_nr,1:_nc])
println(io)
if ( LSAME( ORTBAL, 'B' )||LSAME( BALANC, 'N' )|| LSAME( BALANC, 'P' ) )
# interp call 5
#FOREIGN.dgemm!( 'Transpose', 'No Transpose', M, M, 2*N, ONE, UU, LDUU, UU, LDUU, ZERO, RES, LDRES )
BLAS.gemm!('T','N',ONE,UU[1:2N,1:M],UU[1:2N,1:M],ZERO,view(RES,1:M,1:M))
resid = norm(RES[1:M,1:M] - I)
@test resid < 1e-12
println(io, "orth. resid norm of UU: $resid")
end # if
# interp call 6
# FOREIGN.dgemm!( 'Transpose', 'No Transpose', M, M, N, ONE, UU, LDUU, UU(N+1,1), LDUU, ZERO, RES, LDRES )
BLAS.gemm!('T','N',ONE,UU[1:N,1:M],UU[N+1:2N,1:M],ZERO,view(RES,1:M,1:M))
# interp call 7
#FOREIGN.dgemm!( 'Transpose', 'No Transpose', M, M, N, -ONE, UU(N+1,1), LDUU, UU, LDUU, ONE, RES, LDRES )
BLAS.gemm!('T','N',-ONE,UU[N+1:2N,1:M],UU[1:N,1:M],ONE,view(RES,1:M,1:M))
resid = norm(RES[1:M,1:M])
@test resid < 1e-12
println(io, "sympl. resid norm of UU: $resid")
end # if
end # run_mb03zd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3862 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04ad(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 50
LDH = NMAX
LDQ1 = NMAX
LDQ2 = NMAX
LDT = NMAX
LDU11 = NMAX÷2
LDU12 = NMAX÷2
LDU21 = NMAX÷2
LDU22 = NMAX÷2
LDWORK = 3*NMAX*NMAX + max( NMAX, 48 ) + 6
LDZ = NMAX
LIWORK = NMAX + 18
ZERO = 0.0e0
Z = Array{Float64,2}(undef, LDZ,NMAX)
H = Array{Float64,2}(undef, LDH,NMAX)
Q1 = Array{Float64,2}(undef, LDQ1,NMAX)
Q2 = Array{Float64,2}(undef, LDQ2,NMAX)
U11 = Array{Float64,2}(undef, LDU11,NMAX÷2)
U12 = Array{Float64,2}(undef, LDU12,NMAX÷2)
U21 = Array{Float64,2}(undef, LDU21,NMAX÷2)
U22 = Array{Float64,2}(undef, LDU22,NMAX÷2)
T = Array{Float64,2}(undef, LDT,NMAX)
ALPHAR = Array{Float64,1}(undef, NMAX÷2)
ALPHAI = Array{Float64,1}(undef, NMAX÷2)
BETA = Array{Float64,1}(undef, NMAX÷2)
IWORK = Array{BlasInt,1}(undef, LIWORK)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
JOB = vs[1][1]
COMPQ1 = vs[2][1]
COMPQ2 = vs[3][1]
COMPU1 = vs[4][1]
COMPU2 = vs[5][1]
N = parse(BlasInt, vs[6])
if ( N<0 || N>NMAX )
@error "illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
Z[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
H[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
INFO = SLICOT.mb04ad!(JOB, COMPQ1, COMPQ2, COMPU1, COMPU2, N, Z, H, Q1, Q2, U11, U12, U21, U22, T, ALPHAR, ALPHAI, BETA, LIWORK)
@test INFO == 0
if ( INFO!=0 )
@warn "mb04ad returns info=$INFO"
return
end
M = N÷2
# interp call 2
#FOREIGN.dlaset!( 'Full', M, M, ZERO, ZERO, Z( M+1, 1 ), LDZ )
Z[M+1:M,1:M] .= ZERO
# interp output 1
println(io, "T:")
_nc = N
_nr = N
show(io, "text/plain", T[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "Z:")
_nc = N
_nr = N
show(io, "text/plain", Z[1:_nr,1:_nc])
println(io)
# interp output 3
println(io, "H:")
_nc = N
_nr = N
show(io, "text/plain", H[1:_nr,1:_nc])
println(io)
if ( LSAME( COMPQ1, 'I' ) )
# interp output 4
println(io, "Q1:")
_nc = N
_nr = N
show(io, "text/plain", Q1[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( COMPQ2, 'I' ) )
# interp output 5
println(io, "Q2:")
_nc = N
_nr = N
show(io, "text/plain", Q2[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( COMPU1, 'I' ) )
# interp output 6
println(io, "U11:")
_nc = M
_nr = M
show(io, "text/plain", U11[1:_nr,1:_nc])
println(io)
# interp output 7
println(io, "U12:")
_nc = M
_nr = M
show(io, "text/plain", U12[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( COMPU2, 'I' ) )
# interp output 8
println(io, "U21:")
_nc = M
_nr = M
show(io, "text/plain", U21[1:_nr,1:_nc])
println(io)
# interp output 9
println(io, "U22:")
_nc = M
_nr = M
show(io, "text/plain", U22[1:_nr,1:_nc])
println(io)
end # if
# interp output 10
println(io, "ALPHAR:")
_nr = M
show(io, "text/plain", ALPHAR[1:_nr])
println(io)
# interp output 11
println(io, "ALPHAI:")
_nr = M
show(io, "text/plain", ALPHAI[1:_nr])
println(io)
# interp output 12
println(io, "BETA:")
_nr = M
show(io, "text/plain", BETA[1:_nr])
println(io)
end # run_mb04ad()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3611 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04az(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 50
LDB = NMAX
LDC = NMAX
LDD = NMAX
LDFG = NMAX
LDQ = 2*NMAX
LDU = NMAX
LDWORK = 18*NMAX*NMAX + NMAX + max( 2*NMAX, 24 ) + 3
LDZ = NMAX
LIWORK = 2*NMAX + 9
LZWORK = 8*NMAX + 28
Z = Array{ComplexF64,2}(undef, LDZ,NMAX)
B = Array{ComplexF64,2}(undef, LDB,NMAX)
FG = Array{ComplexF64,2}(undef, LDFG,NMAX)
D = Array{ComplexF64,2}(undef, LDD,NMAX)
C = Array{ComplexF64,2}(undef, LDC,NMAX)
Q = Array{ComplexF64,2}(undef, LDQ,2*NMAX)
U = Array{ComplexF64,2}(undef, LDU,2*NMAX)
ALPHAR = Array{Float64,1}(undef, NMAX)
ALPHAI = Array{Float64,1}(undef, NMAX)
BETA = Array{Float64,1}(undef, NMAX)
BWORK = Array{BlasBool,1}(undef, NMAX)
ZWORK = Array{ComplexF64,1}(undef, LZWORK)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, LIWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
JOB = vs[1][1]
COMPQ = vs[2][1]
COMPU = vs[3][1]
N = parse(BlasInt, vs[4])
if ( N<0 || N>NMAX || mod( N, 2 )!=0 )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
Z[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N÷2,N÷2)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N÷2,N÷2+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
FG[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
close(f)
INFO = SLICOT.mb04az!(JOB, COMPQ, COMPU, N, Z, B, FG, D, C, Q, U, ALPHAR, ALPHAI, BETA, LIWORK, BWORK)
@test INFO == 0
INFO == 0 || return
M = N÷2
if ( LSAME( JOB, 'T' ) )
# interp output 1
println(io, "Z:")
_nc = N
_nr = N
show(io, "text/plain", Z[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "B:")
_nc = N
_nr = N
show(io, "text/plain", UpperTriangular(B[1:_nr,1:_nc]))
println(io)
# interp output 3
println(io, "FG:")
_nc = N
_nr = N
show(io, "text/plain", UpperTriangular(FG[1:_nr,1:_nc]))
println(io)
# interp output 4
println(io, "D:")
_nc = N
_nr = N
show(io, "text/plain", D[1:_nr,1:_nc])
println(io)
# interp output 5
println(io, "C:")
_nc = N
_nr = N
show(io, "text/plain", C[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( COMPQ, 'C' ) )
# interp output 6
println(io, "Q:")
_nc = 2*N
_nr = 2*N
show(io, "text/plain", Q[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( COMPU, 'C' ) )
# interp output 7
println(io, "U:")
_nc = 2*N
_nr = N
show(io, "text/plain", U[1:_nr,1:_nc])
println(io)
end # if
# interp output 8
println(io, "ALPHAR:")
_nr = N
show(io, "text/plain", ALPHAR[1:_nr])
println(io)
# interp output 9
println(io, "ALPHAI:")
_nr = N
show(io, "text/plain", ALPHAI[1:_nr])
println(io)
# interp output 10
println(io, "BETA:")
_nr = N
show(io, "text/plain", BETA[1:_nr])
println(io)
end # run_mb04az()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 4028 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04bd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 50
LDA = NMAX÷2
LDB = NMAX÷2
LDC1 = NMAX÷2
LDC2 = NMAX÷2
LDDE = NMAX÷2
LDF = NMAX÷2
LDQ1 = NMAX
LDQ2 = NMAX
LDVW = NMAX÷2
LDWORK = 2*NMAX*NMAX + max( 4*NMAX, 36 )
LIWORK = max( NMAX + 12, 2*NMAX + 3 )
A = Array{Float64,2}(undef, LDA,NMAX÷2)
DE = Array{Float64,2}(undef, LDDE,NMAX÷2+1)
C1 = Array{Float64,2}(undef, LDC1,NMAX÷2)
VW = Array{Float64,2}(undef, LDVW,NMAX÷2+1)
Q1 = Array{Float64,2}(undef, LDQ1,NMAX)
Q2 = Array{Float64,2}(undef, LDQ2,NMAX)
B = Array{Float64,2}(undef, LDB,NMAX÷2)
F = Array{Float64,2}(undef, LDF,NMAX÷2)
C2 = Array{Float64,2}(undef, LDC2,NMAX÷2)
ALPHAR = Array{Float64,1}(undef, NMAX÷2)
ALPHAI = Array{Float64,1}(undef, NMAX÷2)
BETA = Array{Float64,1}(undef, NMAX÷2)
IWORK = Array{BlasInt,1}(undef, LIWORK)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
JOB = vs[1][1]
COMPQ1 = vs[2][1]
COMPQ2 = vs[3][1]
N = parse(BlasInt, vs[4])
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
end
M = N÷2
vs = String[]
_isz,_jsz = (M,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
DE[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
C1[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
VW[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
INFO = SLICOT.mb04bd!(JOB, COMPQ1, COMPQ2, N, A, DE, C1, VW, Q1, Q2, B, F, C2, ALPHAR, ALPHAI, BETA, LIWORK, LDWORK)
@test INFO == 0
INFO == 0 || return
# interp output 1
println(io, "A:")
_nc = M
_nr = M
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "DE:")
show(io, "text/plain", DE[1:M,2:M+1])
println(io)
# interp output 3
println(io, "B:")
_nc = M
_nr = M
show(io, "text/plain", B[1:_nr,1:_nc])
println(io)
# interp output 4
println(io, "F:")
_nc = M
_nr = M
show(io, "text/plain", UpperTriangular(F[1:_nr,1:_nc]))
println(io)
# interp output 5
println(io, "C1:")
_nc = M
_nr = M
show(io, "text/plain", C1[1:_nr,1:_nc])
println(io)
# interp output 6
println(io, "C2:")
_nc = M
_nr = M
show(io, "text/plain", C2[1:_nr,1:_nc])
println(io)
# interp output 7
println(io, "VW:")
show(io, "text/plain", VW[1:M,2:M+1])
println(io)
# interp output 8
println(io, "ALPHAR:")
_nr = M
show(io, "text/plain", ALPHAR[1:_nr])
println(io)
# interp output 9
println(io, "ALPHAI:")
_nr = M
show(io, "text/plain", ALPHAI[1:_nr])
println(io)
# interp output 10
println(io, "BETA:")
_nr = M
show(io, "text/plain", BETA[1:_nr])
println(io)
if ( !LSAME( COMPQ1, 'N' ) )
# interp output 11
println(io, "Q1:")
_nc = N
_nr = N
show(io, "text/plain", Q1[1:_nr,1:_nc])
println(io)
end # if
if ( !LSAME( COMPQ2, 'N' ) )
# interp output 12
println(io, "Q2:")
_nc = N
_nr = N
show(io, "text/plain", Q2[1:_nr,1:_nc])
println(io)
end
end # run_mb04bd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3380 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04bz(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 50
LDA = NMAX
LDB = NMAX
LDDE = NMAX
LDFG = NMAX
LDQ = 2*NMAX
LDWORK = 11*NMAX*NMAX + 2*NMAX
LZWORK = 8*NMAX + 4
A = Array{ComplexF64,2}(undef, LDA,NMAX)
DE = Array{ComplexF64,2}(undef, LDDE,NMAX)
B = Array{ComplexF64,2}(undef, LDB,NMAX)
FG = Array{ComplexF64,2}(undef, LDFG,NMAX)
Q = Array{ComplexF64,2}(undef, LDQ,2*NMAX)
ALPHAR = Array{Float64,1}(undef, NMAX)
ALPHAI = Array{Float64,1}(undef, NMAX)
BETA = Array{Float64,1}(undef, NMAX)
BWORK = Array{BlasBool,1}(undef, NMAX)
ZWORK = Array{ComplexF64,1}(undef, LZWORK)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, 2*NMAX+3)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
JOB = vs[1][1]
COMPQ = vs[2][1]
N = parse(BlasInt, vs[3])
if ( N<0 || N>NMAX || mod( N, 2 )!=0 )
else
M = N÷2
vs = String[]
_isz,_jsz = (M,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
DE[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,M+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
FG[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
INFO = SLICOT.mb04bz!(JOB, COMPQ, N, A, DE, B, FG, Q, ALPHAR, ALPHAI, BETA, BWORK)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( LSAME( JOB, 'T' ) )
# interp output 1
println(io,"A:")
_nc = N
_nr = N
show(io,"text/plain",A[1:_nr,1:_nc])
println(io,)
# interp output 2
println(io,"DE:")
_nc = N
_nr = N
show(io,"text/plain",DE[1:_nr,1:_nc])
println(io,)
# interp output 3
println(io,"B:")
_nc = N
_nr = N
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
# interp output 4
println(io,"FG:")
_nc = N
_nr = N
show(io,"text/plain",FG[1:_nr,1:_nc])
println(io,)
end # if
if ( LSAME( COMPQ, 'C' ) )
# interp output 5
println(io,"Q:")
_nc = 2*N
_nr = 2*N
show(io,"text/plain",Q[1:_nr,1:_nc])
println(io,)
end # if
# interp output 6
println(io,"ALPHAR:")
_nr = N
show(io,"text/plain",ALPHAR[1:_nr])
println(io,)
# interp output 7
println(io,"ALPHAI:")
_nr = N
show(io,"text/plain",ALPHAI[1:_nr])
println(io,)
# interp output 8
println(io,"BETA:")
_nr = N
show(io,"text/plain",BETA[1:_nr])
println(io,)
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1693 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04dd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 100
LDA = NMAX
LDQG = NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
QG = Array{Float64,2}(undef, LDQG,NMAX+1)
SCALE = Array{Float64,1}(undef, NMAX)
DUMMY = Array{Float64,1}(undef, 1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
JOB = vs[2][1]
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
QG[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
ILO, INFO = SLICOT.mb04dd!(JOB, N, A, QG, SCALE)
@test INFO == 0
INFO == 0 || return
println(io, "ILO = $ILO")
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "QG:")
_nc = N+1
_nr = N
show(io, "text/plain", QG[1:_nr,1:_nc])
println(io)
if ( ILO>1 )
subd = hypot(norm(tril(view(A,2:N,1:ILO-1))),
norm(tril(view(QG,1:N,1:ILO-1))))
println(io, "subdiagonal norm: $subd")
end # if
end # run_mb04dd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2166 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04dl(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 10
LDA = NMAX
LDB = NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
B = Array{Float64,2}(undef, LDB,NMAX)
LSCALE = Array{Float64,1}(undef, NMAX)
RSCALE = Array{Float64,1}(undef, NMAX)
DWORK = Array{Float64,1}(undef, 8*NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
JOB = vs[2][1]
THRESH = parse(Float64, replace(vs[3],'D'=>'E'))
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
ILO, IHI, INFO, IWARN = SLICOT.mb04dl!(JOB, N, THRESH, A, B, LSCALE, RSCALE, DWORK)
@test INFO == 0
INFO == 0 || return
println(io, "ILO = $ILO")
println(io, "IHI = $IHI")
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "B:")
_nc = N
_nr = N
show(io, "text/plain", B[1:_nr,1:_nc])
println(io)
# interp output 3
println(io, "LSCALE:")
_nr = N
show(io, "text/plain", LSCALE[1:_nr])
println(io)
# interp output 4
println(io, "RSCALE:")
_nr = N
show(io, "text/plain", RSCALE[1:_nr])
println(io)
if ( LSAME( JOB, 'S' ) || LSAME( JOB, 'B' ) )
if ( !( THRESH==-2 || THRESH==-4 ) )
println(io, "initial norms: ", DWORK[1:2])
println(io, "final norms: ", DWORK[3:4])
println(io, "final threshold: ", DWORK[5])
else
println(io, "IWARN = $IWARN")
end # if
end # if
end # run_mb04dl()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3028 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04dp(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 10
LDA = NMAX
LDC = NMAX
LDDE = NMAX
LDVW = NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
DE = Array{Float64,2}(undef, LDDE,NMAX+1)
C = Array{Float64,2}(undef, LDC,NMAX)
VW = Array{Float64,2}(undef, LDVW,NMAX+1)
LSCALE = Array{Float64,1}(undef, NMAX)
RSCALE = Array{Float64,1}(undef, NMAX)
DWORK = Array{Float64,1}(undef, 8*NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
JOB = vs[2][1]
THRESH = parse(Float64, replace(vs[3],'D'=>'E'))
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
DE[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
C[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
VW[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
ILO, INFO, IWARN = SLICOT.mb04dp!(JOB, N, THRESH, A, DE, C, VW, LSCALE, RSCALE, DWORK)
@test INFO == 0
INFO == 0 || return
println(io, "ILO = $ILO")
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "DE:")
_nc = N+1
_nr = N
show(io, "text/plain", DE[1:_nr,1:_nc])
println(io)
# interp output 3
println(io, "C:")
_nc = N
_nr = N
show(io, "text/plain", C[1:_nr,1:_nc])
println(io)
# interp output 4
println(io, "VW:")
_nc = N+1
_nr = N
show(io, "text/plain", VW[1:_nr,1:_nc])
println(io)
# interp output 5
println(io, "LSCALE:")
_nr = N
show(io, "text/plain", LSCALE[1:_nr])
println(io)
# interp output 6
println(io, "RSCALE:")
_nr = N
show(io, "text/plain", RSCALE[1:_nr])
println(io)
if ( LSAME( JOB, 'S' ) || LSAME( JOB, 'B' ) )
if ( !( THRESH==-2 || THRESH==-4 ) )
println(io, "initial norms: ", DWORK[1:2])
println(io, "initial norms: ", DWORK[3:4])
println(io, "final threshold: ", DWORK[5])
else
println(io, "IWARN = $IWARN")
end # if
end # if
end # run_mb04dp()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1673 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04ds(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 100
LDA = NMAX
LDQG = NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
QG = Array{Float64,2}(undef, LDQG,NMAX+1)
SCALE = Array{Float64,1}(undef, NMAX)
DUMMY = Array{Float64,1}(undef, 1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
JOB = vs[2][1]
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
QG[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
ILO, INFO = SLICOT.mb04ds!(JOB, N, A, QG, SCALE)
@test INFO == 0
INFO == 0 || return
println(io, "ILO = $ILO")
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "QG:")
_nc = N+1
_nr = N
show(io, "text/plain", QG[1:_nr,1:_nc])
println(io)
if ( ILO>1 )
subd = hypot(norm(tril(view(A,2:N,1:ILO-1))),
norm(tril(view(QG,2:N,1:ILO-1))))
println(io, "subdiagonal norm: $subd")
end # if
end # run_mb04ds()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2051 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04dy(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
LDA = NMAX
LDQG = NMAX
LDWORK = NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
QG = Array{Float64,2}(undef, LDQG,NMAX+1)
D = Array{Float64,1}(undef, NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
JOBSCL = vs[2][1]
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*(_jsz+1)÷2
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
_i0 = 0
for j in 1:_jsz
QG[j,j+1:_jsz+1] .= parsex.(Float64, vs[_i0+1:_i0+_jsz-j+1])
_i0 += _jsz-j+1
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*(_jsz+1)÷2
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
_i0 = 0
for j in 1:_jsz
QG[j:_jsz,j] .= parsex.(Float64, vs[_i0+1:_i0+_jsz-j+1])
_i0 += _jsz-j+1
end
close(f)
# interp call 1
INFO = SLICOT.mb04dy!(JOBSCL, N, A, QG, D)
@test INFO == 0
INFO != 0 && return
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "QG:")
_nc = N+1
_nr = N
show(io, "text/plain", QG[1:_nr,1:_nc])
println(io)
if ( LSAME( JOBSCL, 'S' ) )
# interp output 3
println(io, "D:")
_nr = N
show(io, "text/plain", D[1:_nr])
println(io)
elseif ( LSAME( JOBSCL, '1' ) || LSAME( JOBSCL, 'O' ) )
println(io, "tau = ",D[1])
end # if
end # run_mb04dy()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1690 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04dz(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 100
LDA = NMAX
LDQG = NMAX
A = Array{ComplexF64,2}(undef, LDA,NMAX)
QG = Array{ComplexF64,2}(undef, LDQG,NMAX+1)
SCALE = Array{Float64,1}(undef, NMAX)
DUMMY = Array{Float64,1}(undef, 1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
JOB = vs[2][1]
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
QG[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
ILO, INFO = SLICOT.mb04dz!(JOB, N, A, QG, SCALE)
@test INFO == 0
INFO == 0 || return
println(io, "ILO = $ILO")
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "QG:")
_nc = N+1
_nr = N
show(io, "text/plain", QG[1:_nr,1:_nc])
println(io)
if ( ILO>1 )
subd = hypot(norm(tril(view(A,2:N,1:ILO-1))),
norm(tril(view(QG,1:N,1:ILO-1))))
println(io, "subdiagonal norm: $subd")
end # if
end # run_mb04dz()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3722 | # Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04ed(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 60
LDB = NMAX÷2
LDFG = NMAX÷2
LDQ = NMAX
LDU1 = NMAX÷2
LDU2 = NMAX÷2
LDWORK = 3*NMAX^2÷2 + max( NMAX, 24 ) + 3
LDZ = NMAX
LIWORK = NMAX + 9
Z = Array{Float64,2}(undef, LDZ,NMAX)
B = Array{Float64,2}(undef, LDB,NMAX÷2)
FG = Array{Float64,2}(undef, LDFG,NMAX÷2+1)
Q = Array{Float64,2}(undef, LDQ,NMAX)
U1 = Array{Float64,2}(undef, LDU1,NMAX÷2)
U2 = Array{Float64,2}(undef, LDU2,NMAX÷2)
ALPHAR = Array{Float64,1}(undef, NMAX÷2)
ALPHAI = Array{Float64,1}(undef, NMAX÷2)
BETA = Array{Float64,1}(undef, NMAX÷2)
IWORK = Array{BlasInt,1}(undef, LIWORK)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
JOB = vs[1][1]
COMPQ = vs[2][1]
COMPU = vs[3][1]
N = parse(BlasInt, vs[4])
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
Z[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N÷2,N÷2)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N÷2,N÷2+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
FG[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
if ( LSAME( COMPU, 'U' ) )
vs = String[]
_isz,_jsz = (N÷2,N÷2)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
U1[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N÷2,N÷2)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
U2[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end # if
if ( N<0 || N>NMAX || mod( N, 2 )!=0 )
else
# interp call 1
INFO = SLICOT.mb04ed!(JOB, COMPQ, COMPU, N, Z, B, FG, Q, U1, U2, ALPHAR, ALPHAI, BETA, LIWORK)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
# interp output 1
println(io,"Z:")
_nc = N
_nr = N
show(io,"text/plain",Z[1:_nr,1:_nc])
println(io,)
# interp output 2
println(io,"B:")
_nc = N÷2
_nr = N÷2
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
# interp output 3
println(io,"FG:")
_nc = N÷2+1
_nr = N÷2
show(io,"text/plain",FG[1:_nr,1:_nc])
println(io,)
# interp output 4
println(io,"ALPHAR:")
_nr = N÷2
show(io,"text/plain",ALPHAR[1:_nr])
println(io,)
# interp output 5
println(io,"ALPHAI:")
_nr = N÷2
show(io,"text/plain",ALPHAI[1:_nr])
println(io,)
# interp output 6
println(io,"BETA:")
_nr = N÷2
show(io,"text/plain",BETA[1:_nr])
println(io,)
# interp output 7
println(io,"Q:")
_nc = N
_nr = N
show(io,"text/plain",Q[1:_nr,1:_nc])
println(io,)
if ( !LSAME( COMPU, 'N' ) )
# interp output 8
println(io,"U1:")
_nc = N÷2
_nr = N÷2
show(io,"text/plain",U1[1:_nr,1:_nc])
println(io,)
# interp output 9
println(io,"U2:")
_nc = N÷2
_nr = N÷2
show(io,"text/plain",U2[1:_nr,1:_nc])
println(io,)
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3307 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04fd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 50
LDA = NMAX÷2
LDB = NMAX÷2
LDDE = NMAX÷2
LDFG = NMAX÷2
LDQ = NMAX
LDWORK = 3*NMAX*NMAX÷4
A = Array{Float64,2}(undef, LDA,NMAX÷2)
DE = Array{Float64,2}(undef, LDDE,NMAX÷2+1)
B = Array{Float64,2}(undef, LDB,NMAX÷2)
FG = Array{Float64,2}(undef, LDFG,NMAX÷2+1)
Q = Array{Float64,2}(undef, LDQ,NMAX)
ALPHAR = Array{Float64,1}(undef, NMAX÷2)
ALPHAI = Array{Float64,1}(undef, NMAX÷2)
BETA = Array{Float64,1}(undef, NMAX÷2)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, NMAX÷2+1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
JOB = vs[1][1]
COMPQ = vs[2][1]
N = parse(BlasInt, vs[3])
vs = String[]
_isz,_jsz = (N÷2,N÷2)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N÷2,N÷2+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
DE[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N÷2,N÷2)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N÷2,N÷2+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
FG[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
if ( N<0 || N>NMAX || mod( N, 2 )!=0 )
else
# interp call 1
INFO = SLICOT.mb04fd!(JOB, COMPQ, N, A, DE, B, FG, Q, ALPHAR, ALPHAI, BETA)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( LSAME( JOB, 'T' ) )
# interp output 1
println(io,"A:")
_nc = N÷2
_nr = N÷2
show(io,"text/plain",A[1:_nr,1:_nc])
println(io,)
end # if
# interp output 2
println(io,"DE:")
_nc = N÷2+1
_nr = N÷2
show(io,"text/plain",DE[1:_nr,1:_nc])
println(io,)
if ( LSAME( JOB, 'T' ) )
# interp output 3
println(io,"B:")
_nc = N÷2
_nr = N÷2
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
end # if
# interp output 4
println(io,"FG:")
_nc = N÷2+1
_nr = N÷2
show(io,"text/plain",FG[1:_nr,1:_nc])
println(io,)
if ( !LSAME( COMPQ, 'N' ) )
# interp output 5
println(io,"Q:")
_nc = N
_nr = N
show(io,"text/plain",Q[1:_nr,1:_nc])
println(io,)
end # if
# interp output 6
println(io,"ALPHAR:")
_nr = N÷2
show(io,"text/plain",ALPHAR[1:_nr])
println(io,)
# interp output 7
println(io,"ALPHAI:")
_nr = N÷2
show(io,"text/plain",ALPHAI[1:_nr])
println(io,)
# interp output 8
println(io,"BETA:")
_nr = N÷2
show(io,"text/plain",BETA[1:_nr])
println(io,)
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1973 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04gd(datfile, io=stdout)
ZERO = 0.0e0
NIN = 5
NOUT = 6
NMAX = 10
MMAX = 10
LDA = MMAX
LDTAU = min(MMAX,NMAX)
LDWORK = 3*MMAX
A = Array{Float64,2}(undef, LDA,NMAX)
JPVT = Array{BlasInt,1}(undef, MMAX)
TAU = Array{Float64,1}(undef, LDTAU)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
M = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
end
if ( M<0 || M>MMAX )
@error "Illegal M=$M"
end
vs = String[]
_isz,_jsz = (M,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz = M
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
JPVT[1:_isz] .= parsex.(BlasInt, vs)
close(f)
# interp call 1
INFO = SLICOT.mb04gd!(M, N, A, JPVT, TAU)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
@warn "mb04gd returns info=$INFO"
return
end
# interp output 1
println(io, "JPVT:")
_nr = M
show(io, "text/plain", JPVT[1:_nr])
println(io)
if ( M>=N )
if N>1
# interp call 2
#FOREIGN.dlaset!( 'Lower', N-1, N-1, ZERO, ZERO, A(M-N+2,1), LDA )
triu!(view(A,M-N+1:M,1:N-1))
end
else
# interp call 3
#FOREIGN.dlaset!( 'Full', M, N-M-1, ZERO, ZERO, A, LDA )
A[1:M,1:N-M-1] .= ZERO
# interp call 4
#FOREIGN.dlaset!( 'Lower', M, M, ZERO, ZERO, A(1,N-M), LDA )
triu!(view(A,1:M,N-M:N-1),1)
end # if
# interp output 2
println(io, "A:")
_nc = N
_nr = M
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
end # run_mb04gd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1222 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04md(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
LDA = NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
SCALE = Array{Float64,1}(undef, NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
MAXRED = parse(Float64, replace(vs[2],'D'=>'E'))
if ( N<=0 || N>NMAX )
else
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
MAXRED, INFO = SLICOT.mb04md!(N, MAXRED, A, SCALE)
println(io, "MAXRED = $MAXRED")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
# interp output 1
println(io,"A:")
_nc = N
_nr = N
show(io,"text/plain",A[1:_nr,1:_nc])
println(io,)
# interp output 2
println(io,"SCALE:")
_nr = N
show(io,"text/plain",SCALE[1:_nr])
println(io,)
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2439 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04od(datfile, io=stdout)
ZERO = 0.0e0
NIN = 5
NOUT = 6
MMAX = 20
NMAX = 20
PMAX = 20
LDA = PMAX
LDB = NMAX
LDC = PMAX
LDR = NMAX
LDWORK = max( NMAX-1,MMAX )
R = Array{Float64,2}(undef, LDR,NMAX)
A = Array{Float64,2}(undef, LDA,NMAX)
B = Array{Float64,2}(undef, LDB,MMAX)
C = Array{Float64,2}(undef, LDC,MMAX)
TAU = Array{Float64,1}(undef, NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
M = parse(BlasInt, vs[2])
P = parse(BlasInt, vs[3])
UPLO = vs[4][1]
if ( N<0 || N>NMAX )
else
if ( M<0 || M>MMAX )
else
if ( P<0 || P>PMAX )
else
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
R[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (P,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (P,M)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
C[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
SLICOT.mb04od!(UPLO, N, M, P, R, A, B, C, TAU)
triu!(R)
# interp output 1
println(io,"R:")
_nc = N
_nr = N
show(io,"text/plain",R[1:_nr,1:_nc])
println(io,)
if ( M>0 )
# interp output 2
println(io,"B:")
_nc = M
_nr = N
show(io,"text/plain",B[1:_nr,1:_nc])
println(io,)
if ( P>0 )
# interp output 3
println(io,"C:")
_nc = M
_nr = P
show(io,"text/plain",C[1:_nr,1:_nc])
println(io,)
end # if
end # if
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 7403 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04pb(datfile, io=stdout)
ZERO = 0.0e0
ONE = 1.0e0
TWO = 2.0e0
NIN = 5
NOUT = 6
NMAX = 7
NBMAX = 3
LDA = NMAX
LDQG = NMAX
LDRES = NMAX
LDU1 = NMAX
LDU2 = NMAX
LDWORK = 8*NBMAX*NMAX + 3*NBMAX
A = Array{Float64,2}(undef, LDA,NMAX)
QG = Array{Float64,2}(undef, LDQG,NMAX+1)
CS = Array{Float64,1}(undef, 2*NMAX)
TAU = Array{Float64,1}(undef, NMAX)
U1 = Array{Float64,2}(undef, LDU1,NMAX)
U2 = Array{Float64,2}(undef, LDU2,NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
RES = Array{Float64,2}(undef, LDRES,3*NMAX+1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
if ( N<=0 || N>NMAX )
@error "illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
#FOREIGN.dlacpy!( 'All', N, N, A, LDA, RES(1,N+1), LDRES )
RES[1:N,N+1:2*N] .= A[1:N,1:N]
vs = String[]
_isz,_jsz = (N,N+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
QG[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 2
#FOREIGN.dlacpy!( 'All', N, N+1, QG, LDQG, RES(1,2*N+1), LDRES )
RES[1:N,2*N+1:3*N+1] .= QG[1:N,1:N+1]
# interp call 3
INFO = SLICOT.mb04pb!(N, 1, A, QG, CS, TAU)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
@warn "mb04pb returns info=$INFO"
return
end
# interp call 4
#FOREIGN.dlacpy!( 'Lower', N, N, A, LDA, U1, LDU1 )
U1[1:N,1:N] .= tril(view(A,1:N,1:N))
# interp call 5
#FOREIGN.dlacpy!( 'Lower', N, N, QG, LDQG, U2, LDU2 )
U2[1:N,1:N] .= tril(view(QG,1:N,1:N))
# interp call 6
INFO = SLICOT.mb04wp!(N, 1, U1, U2, CS, TAU)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
@warn "mb04wp returns info=$INFO"
return
end
if N>2
# interp call 7
#FOREIGN.dlaset!( 'Lower', N-2, N-2, ZERO, ZERO, A(3,1), LDA )
triu!(view(A,2:N,1:N-2))
end
if N>1
# interp call 8
#FOREIGN.dlaset!( 'Lower', N-1, N-1, ZERO, ZERO, QG(2,1), LDQG )
triu!(view(QG,1:N,1:N-1))
end
# interp output 1
println(io, "U1:")
_nc = N
_nr = N
show(io, "text/plain", U1[1:_nr,1:_nc])
println(io)
println(io, "U2:")
_nc = N
_nr = N
show(io, "text/plain", U2[1:_nr,1:_nc])
println(io)
# unable to translate write statement:
# write MA02JD( .FALSE., .FALSE., N, U1, LDU1, U2, LDU2, RES, LDRES )
resnorm = SLICOT.ma02jd!(false,false,N,U1,U2)
println(io, "orth. residual norm = $resnorm")
@test resnorm < 1e-12
# interp output 2
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 3
println(io, "QG:")
_nc = N+1
_nr = N
show(io, "text/plain", QG[1:_nr,1:_nc])
println(io)
# interp call 9
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, U1, LDU1, A, LDA, ZERO, RES, LDRES )
BLAS.gemm!('N','N',ONE,U1[1:N,1:N],A[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 10
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, -ONE, RES, LDRES, U1, LDU1, ONE, RES(1,N+1), LDRES )
BLAS.gemm!('N','T',-ONE,RES[1:N,1:N],U1[1:N,1:N],ONE,view(RES,1:N,N+1:2N))
# interp call 11
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, ONE, U2, LDU2, A, LDA, ZERO, RES, LDRES )
BLAS.gemm!('N','T',ONE,U2[1:N,1:N],A[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 12
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, ONE, RES, LDRES, U2, LDU2, ONE, RES(1,N+1), LDRES )
BLAS.gemm!('N','T',ONE,RES[1:N,1:N],U2[1:N,1:N],ONE,view(RES,1:N,N+1:2N))
# interp call 13
#FOREIGN.dsymm!( 'Right', 'Upper', N, N, ONE, QG(1,2), LDQG, U1, LDU1, ZERO, RES, LDRES )
BLAS.symm!('R','U',ONE,QG[1:N,2:N+1],U1[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 14
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, -ONE, RES, LDRES, U2, LDU2, ONE, RES(1,N+1), LDRES )
BLAS.gemm!('N','T',-ONE,RES[1:N,1:N],U2[1:N,1:N],ONE,view(RES,1:N,N+1:2N))
# was DLACPY
RES[1:N,1:N] .= U2[1:N,1:N]
# interp call 15
#FOREIGN.dscal!( N, QG(I,I), RES(1,I), 1 )
for i in 1:N
RES[1:N,i] .*= QG[i,i]
end
# interp call 16
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, -ONE, RES, LDRES, U1, LDU1, ONE, RES(1,N+1), LDRES )
BLAS.gemm!('N','T',-ONE,RES[1:N,1:N],U1[1:N,1:N],ONE,view(RES,1:N,N+1:2N))
# interp call 17
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, U2, LDU2, A, LDA, ZERO, RES, LDRES )
BLAS.gemm!('N','N',ONE,U2[1:N,1:N],A[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 18
#FOREIGN.dsyr2k!( 'Lower', 'No Transpose', N, N, ONE, RES, LDRES, U1, LDU1, ONE, RES(1,2*N+1), LDRES )
BLAS.syr2k!('L','N',1.0,RES[1:N,1:N],U1[1:N,1:N],1.0,view(RES,1:N,2*N+1:3*N))
# interp call 19
#FOREIGN.dscal!( N, ONE/TWO, QG(1,2), LDQG+1 )
for i in 1:N
QG[i,i+1] *= 1/2
end
RES[1:N,1:N] .= U2[1:N,1:N]
# interp call 20
#FOREIGN.dtrmm!( 'Right', 'Upper' , 'No Transpose', 'Not unit', N, N, ONE, QG(1,2), LDQG, RES, LDRES )
BLAS.trmm!('R','U','N','N',1.0,view(QG,1:N,2:N+1),view(RES,1:N,1:N))
# interp call 21
#FOREIGN.dsyr2k!( 'Lower', 'No Transpose', N, N, ONE, RES, LDRES, U2, LDU2, ONE, RES(1,2*N+1), LDRES )
BLAS.syr2k!('L','N',1.0,view(RES,1:N,1:N),view(U2,1:N,1:N),1.0,view(RES,1:N,2*N+1:3*N))
# interp call 22
for i in 1:N
#FOREIGN.dsyr!( 'Lower', N, -QG(I,I), U1(1,I), 1, RES(1,2*N+1), LDRES )
BLAS.syr!('L',-QG[i,i],U1[1:N,i],view(RES,1:N,2*N+1:3*N))
end
# interp call 23
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, U1, LDU1, A, LDA, ZERO, RES, LDRES )
BLAS.gemm!('N','N',1.0,view(U1,1:N,1:N),view(A,1:N,1:N),0.0,view(RES,1:N,1:N))
# interp call 24
#FOREIGN.dsyr2k!( 'Upper', 'No Transpose', N, N, ONE, RES, LDRES, U2, LDU2, ONE, RES(1,2*N+2), LDRES )
BLAS.syr2k!('U','N',1.0,view(RES,1:N,1:N),view(U2,1:N,1:N),1.0,view(RES,1:N,2*N+2:3*N+1))
RES[1:N,1:N] .= U1[1:N,1:N]
# interp call 25
#FOREIGN.dtrmm!( 'Right', 'Upper' , 'No Transpose', 'Not unit', N, N, ONE, QG(1,2), LDQG, RES, LDRES )
BLAS.trmm!('R','U','N','N',1.0,view(QG,1:N,2:N+1),view(RES,1:N,1:N))
# interp call 26
#FOREIGN.dsyr2k!( 'Upper', 'No Transpose', N, N, -ONE, RES, LDRES, U1, LDU1, ONE, RES(1,2*N+2), LDRES )
BLAS.syr2k!('U','N',-1.0,view(RES,1:N,1:N),view(U1,1:N,1:N),1.0,view(RES,1:N,2*N+2:3*N+1))
# interp call 27
for i in 1:N
#FOREIGN.dsyr!( 'Upper', N, QG(I,I), U2(1,I), 1, RES(1,2*N+2), LDRES )
BLAS.syr!('U',QG[i,i],U2[1:N,i],view(RES,1:N,2*N+2:3*N+1))
end
# unable to translate write statement:
# write MA02ID( 'Hamiltonian', 'Frobenius', N, RES(1,N+1), LDRES, RES(1,2*N+1), LDRES, DWORK )
resnorm = SLICOT.ma02id!('H','F',N,view(RES,1:N,N+1:2*N),view(RES,1:N,2*N+1:3*N),DWORK)
println(io, "residual norm = $resnorm")
@test resnorm < 1e-12
end # run_mb04pb()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 7222 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04pu(datfile, io=stdout)
ZERO = 0.0e0
ONE = 1.0e0
TWO = 2.0e0
NIN = 5
NOUT = 6
NMAX = 100
LDA = NMAX
LDQG = NMAX
LDRES = NMAX
LDU1 = NMAX
LDU2 = NMAX
LDWORK = 2*NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
QG = Array{Float64,2}(undef, LDQG,NMAX+1)
CS = Array{Float64,1}(undef, 2*NMAX)
TAU = Array{Float64,1}(undef, NMAX)
U1 = Array{Float64,2}(undef, LDU1,NMAX)
U2 = Array{Float64,2}(undef, LDU2,NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
RES = Array{Float64,2}(undef, LDRES,3*NMAX+1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
if ( N<=0 || N>NMAX )
@error "invalid N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
#FOREIGN.dlacpy!( 'All', N, N, A, LDA, RES(1,N+1), LDRES )
RES[1:N,N+1:2N] .= A[1:N,1:N]
vs = String[]
_isz,_jsz = (N,N+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
QG[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 2
#FOREIGN.dlacpy!( 'All', N, N+1, QG, LDQG, RES(1,2*N+1), LDRES )
RES[1:N,2*N+1:3N+1] .= QG[1:N,1:N+1]
close(f)
# interp call 3
INFO = SLICOT.mb04pu!(N, 1, A, QG, CS, TAU, LDWORK)
@test INFO == 0
INFO == 0 || return
# yes, this is from the original
# INFO = 0
# if ( INFO!=0 )
# else
# interp call 4
#FOREIGN.dlacpy!( 'Lower', N, N, A, LDA, U1, LDU1 )
U1[1:N,1:N] .= tril(A[1:N,1:N])
# interp call 5
#FOREIGN.dlacpy!( 'Lower', N, N, QG, LDQG, U2, LDU2 )
U2[1:N,1:N] .= tril(QG[1:N,1:N])
# interp call 6
INFO = SLICOT.mb04wp!(N, 1, U1, U2, CS, TAU)
@test INFO == 0
INFO == 0 || return
if N>2
# interp call 7
# FOREIGN.dlaset!( 'Lower', N-2, N-2, ZERO, ZERO, A(3,1), LDA )
triu!(view(A,2:N,1:N-2))
end
if N>1
# interp call 8
# FOREIGN.dlaset!( 'Lower', N-1, N-1, ZERO, ZERO, QG(2,1), LDQG )
triu!(view(QG,1:N,1:N-1))
end
# interp output 1
println(io, "U1:")
_nc = N
_nr = N
show(io, "text/plain", U1[1:_nr,1:_nc])
println(io)
println(io, "U2:")
_nc = N
_nr = N
show(io, "text/plain", U2[1:_nr,1:_nc])
println(io)
# unable to translate write statement:
# write MA02JD( .FALSE., .FALSE., N, U1, LDU1, U2, LDU2, RES, LDRES )
resnorm = SLICOT.ma02jd!(false,false,N,U1,U2)
println(io, "U orth. residual norm = $resnorm")
@test resnorm < 1e-12
# interp output 2
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 3
println(io, "QG:")
_nc = N+1
_nr = N
show(io, "text/plain", QG[1:_nr,1:_nc])
println(io)
# interp call 9
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, U1, LDU1, A, LDA, ZERO, RES, LDRES )
BLAS.gemm!('N','N',ONE,U1[1:N,1:N],A[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 10
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, -ONE, RES, LDRES, U1, LDU1, ONE, RES(1,N+1), LDRES )
BLAS.gemm!('N','T',-ONE,RES[1:N,1:N],U1[1:N,1:N],ONE,view(RES,1:N,N+1:2N))
# interp call 11
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, ONE, U2, LDU2, A, LDA, ZERO, RES, LDRES )
BLAS.gemm!('N','T',ONE,U2[1:N,1:N],A[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 12
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, ONE, RES, LDRES, U2, LDU2, ONE, RES(1,N+1), LDRES )
BLAS.gemm!('N','T',ONE,RES[1:N,1:N],U2[1:N,1:N],ONE,view(RES,1:N,N+1:2N))
# interp call 13
#FOREIGN.dsymm!( 'Right', 'Upper', N, N, ONE, QG(1,2), LDQG, U1, LDU1, ZERO, RES, LDRES )
BLAS.symm!('R','U',ONE,QG[1:N,2:N+1],U1[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 14
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, -ONE, RES, LDRES, U2, LDU2, ONE, RES(1,N+1), LDRES )
BLAS.gemm!('N','T',-ONE,RES[1:N,1:N],U2[1:N,1:N],ONE,view(RES,1:N,N+1:2N))
RES[1:N,1:N] .= U2[1:N,1:N]
# interp call 15
for i in 1:N
# FOREIGN.dscal!( N, QG(I,I), RES(1,I), 1 )
RES[1:N,i] .*= QG[i,i]
end
# interp call 16
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, -ONE, RES, LDRES, U1, LDU1, ONE, RES(1,N+1), LDRES )
BLAS.gemm!('N','T',-ONE,RES[1:N,1:N],U1[1:N,1:N],ONE,view(RES,1:N,N+1:2N))
# interp call 17
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, U2, LDU2, A, LDA, ZERO, RES, LDRES )
BLAS.gemm!('N','N',ONE,U2[1:N,1:N],A[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 18
#FOREIGN.dsyr2k!( 'Lower', 'No Transpose', N, N, ONE, RES, LDRES, U1, LDU1, ONE, RES(1,2*N+1), LDRES )
BLAS.syr2k!('L','N',ONE,RES[1:N,1:N],U1[1:N,1:N],ONE,view(RES,1:N,2*N+1:3N))
# interp call 19
#FOREIGN.dscal!( N, ONE/TWO, QG(1,2), LDQG+1 )
for i in 1:N
QG[i,i+1] *= 1/2
end
RES[1:N,1:N] .= U2[1:N,1:N]
# interp call 20
#FOREIGN.dtrmm!( 'Right', 'Upper' , 'No Transpose', 'Not unit', N, N, ONE, QG(1,2), LDQG, RES, LDRES )
BLAS.trmm!('R','U','N','N',ONE,QG[1:N,2:N+1],view(RES,1:N,1:N))
# interp call 21
#FOREIGN.dsyr2k!( 'Lower', 'No Transpose', N, N, ONE, RES, LDRES, U2, LDU2, ONE, RES(1,2*N+1), LDRES )
BLAS.syr2k!('L','N',ONE,RES[1:N,1:N],U2[1:N,1:N],ONE,view(RES,1:N,2N+1:3N))
# interp call 22
for i in 1:N
#FOREIGN.dsyr!( 'Lower', N, -QG(I,I), U1(1,I), 1, RES(1,2*N+1), LDRES )
BLAS.syr!('L',-QG[i,i],U1[1:N,i],view(RES,1:N,2*N+1:3N))
end
# interp call 23
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, U1, LDU1, A, LDA, ZERO, RES, LDRES )
BLAS.gemm!('N','N',ONE,U1[1:N,1:N],A[1:N,1:N],ZERO,view(RES,1:N,1:N))
# interp call 24
#FOREIGN.dsyr2k!( 'Upper', 'No Transpose', N, N, ONE, RES, LDRES, U2, LDU2, ONE, RES(1,2*N+2), LDRES )
BLAS.syr2k!('U','N',ONE,RES[1:N,1:N],U2[1:N,1:N],ONE,view(RES,1:N,2*N+2:3*N+1))
RES[1:N,1:N] .= U1[1:N,1:N]
# interp call 25
#FOREIGN.dtrmm!( 'Right', 'Upper' , 'No Transpose', 'Not unit', N, N, ONE, QG(1,2), LDQG, RES, LDRES )
BLAS.trmm!('R','U','N','N',ONE,QG[1:N,2:N+1],view(RES,1:N,1:N))
# interp call 26
#FOREIGN.dsyr2k!( 'Upper', 'No Transpose', N, N, -ONE, RES, LDRES, U1, LDU1, ONE, RES(1,2*N+2), LDRES )
BLAS.syr2k!('U','N',-ONE,RES[1:N,1:N],U1[1:N,1:N],ONE,view(RES,1:N,2*N+2:3*N+1))
# interp call 27
for i in 1:N
#FOREIGN.dsyr!( 'Upper', N, QG(I,I), U2(1,I), 1, RES(1,2*N+2), LDRES )
BLAS.syr!('U',QG[i,i],U2[1:N,i],view(RES,1:N,2*N+2:3*N+1))
end
# unable to translate write statement:
# write MA02ID( 'Hamiltonian', 'Frobenius', N, RES(1,N+1), LDRES, RES(1,2*N+1), LDRES, DWORK )
resnorm = SLICOT.ma02id!('H','F',N,view(RES,1:N,N+1:2*N),view(RES,1:N,2*N+1:3*N),DWORK)
println(io, "residual norm = $resnorm")
@test resnorm < 1e-12
end # run_mb04pu()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 10674 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04tb(datfile, io=stdout)
ZERO = 0.0e0
ONE = 1.0e0
NIN = 5
NOUT = 6
NBMAX = 64
NMAX = 421
LDA = NMAX
LDB = NMAX
LDG = NMAX
LDQ = NMAX
LDRES = NMAX
LDU1 = NMAX
LDU2 = NMAX
LDV1 = NMAX
LDV2 = NMAX
LDWORK = NBMAX*( 16*NMAX + 1 )
A = Array{Float64,2}(undef, LDA,NMAX)
B = Array{Float64,2}(undef, LDB,NMAX)
G = Array{Float64,2}(undef, LDG,NMAX)
Q = Array{Float64,2}(undef, LDQ,NMAX)
CSL = Array{Float64,1}(undef, 2*NMAX)
CSR = Array{Float64,1}(undef, 2*NMAX)
TAUL = Array{Float64,1}(undef, NMAX)
TAUR = Array{Float64,1}(undef, NMAX)
U1 = Array{Float64,2}(undef, LDU1,NMAX)
U2 = Array{Float64,2}(undef, LDU2,NMAX)
V1 = Array{Float64,2}(undef, LDV1,NMAX)
V2 = Array{Float64,2}(undef, LDV2,NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
RES = Array{Float64,2}(undef, LDRES,5*NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
TRANA = vs[2][1]
TRANB = vs[3][1]
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
RES[1:N,1:N] .= A[1:N,1:N]
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
#FOREIGN.dlacpy!( 'All', N, N, B, LDB, RES(1,N+1), LDRES )
RES[1:N,N+1:2N] .= B[1:N,1:N]
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
G[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 2
#FOREIGN.dlacpy!( 'All', N, N, G, LDG, RES(1,2*N+1), LDRES )
RES[1:N,2*N+1:3N] .= G[1:N,1:N]
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
Q[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 3
#FOREIGN.dlacpy!( 'All', N, N, Q, LDQ, RES(1,3*N+1), LDRES )
RES[1:N,3*N+1:4N] .= Q[1:N,1:N]
close(f)
# interp call 4
INFO = SLICOT.mb04tb!(TRANA, TRANB, N, 1, A, B, G, Q, CSL, CSR, TAUL, TAUR)
@test INFO == 0
INFO == 0 || return
U1[1:N,1:N] .= A[1:N,1:N]
U2[1:N,1:N] .= Q[1:N,1:N]
# interp call 5
INFO = SLICOT.mb04wr!('U', TRANA, N, 1, U1, U2, CSL, TAUL)
@test INFO == 0
INFO == 0 || return
V2[1:N,1:N] .= Q[1:N,1:N]
V1[1:N,1:N] .= B[1:N,1:N]
# interp call 6
INFO = SLICOT.mb04wr!('V', TRANB, N, 1, V1, V2, CSR, TAUR)
@test INFO == 0
INFO == 0 || return
if ( LSAME( TRANA, 'N' ) )
# interp output 1
println(io, "U1:")
_nc = N
_nr = N
show(io, "text/plain", U1[1:_nr,1:_nc])
println(io)
println(io, "U2:")
_nc = N
_nr = N
show(io, "text/plain", U2[1:_nr,1:_nc])
println(io)
# unable to translate write statement:
# write MA02JD( .FALSE., .FALSE., N, U1, LDU1, U2, LDU2, RES(1,4*N+1), LDRES )
resnorm = SLICOT.ma02jd!(false,false,N,U1,U2)
println(io, "U orth. residual norm = $resnorm")
@test resnorm < 1e-12
else
# interp output 2
println(io, "U1:")
_nc = N
_nr = N
show(io, "text/plain", U1[1:_nr,1:_nc])
println(io)
println(io, "U2:")
_nc = N
_nr = N
show(io, "text/plain", U2[1:_nr,1:_nc])
println(io)
resnorm = SLICOT.ma02jd!(true,false,N,U1,U2)
println(io, "U orth. residual norm = $resnorm")
@test resnorm < 1e-12
# unable to translate write statement:
# write MA02JD( .TRUE., .FALSE., N, U1, LDU1, U2, LDU2, RES(1,4*N+1), LDRES )
end # if
# interp call 7
#FOREIGN.dlaset!( 'All', N, N, ZERO, ZERO, Q, LDQ )
Q[1:N,1:N] .= ZERO
if ( LSAME( TRANA, 'N' ) )
# interp call 8
#FOREIGN.dlaset!( 'Lower', N-1, N-1, ZERO, ZERO, A(2,1), LDA )
triu!(view(A,1:N,1:N-1))
# interp output 3
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
println(io, "G:")
show(io, "text/plain", G[1:_nr,1:_nc])
println(io)
else
# interp call 9
#FOREIGN.dlaset!( 'Upper', N-1, N-1, ZERO, ZERO, A(1,2), LDA )
tril!(view(A,1:N-1,1:N))
# interp output 4
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
println(io, "G:")
show(io, "text/plain", G[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( TRANB, 'N' ) )
if ( N>1 )
# interp call 10
#FOREIGN.dlaset!( 'Upper', N-2, N-2, ZERO, ZERO, B(1,3), LDB )
tril!(view(B,1:N-1,2:N))
end # if
# interp output 5
_nc = N
_nr = N
println(io, "Q:")
show(io, "text/plain", Q[1:_nr,1:_nc])
println(io)
println(io, "B:")
show(io, "text/plain", B[1:_nr,1:_nc])
println(io)
else
if ( N>1 )
triu!(view(B,2:N-1,1:N-2))
end # if
_nc = N
_nr = N
println(io, "Q:")
show(io, "text/plain", Q[1:_nr,1:_nc])
println(io)
println(io, "B:")
show(io, "text/plain", B[1:_nr,1:_nc])
println(io)
# interp output 6
end # if
if ( LSAME( TRANB, 'N' ) )
TRANV1 = 'T'
else
TRANV1 = 'N'
end # if
# interp call 11
#FOREIGN.dgemm!( TRANA, TRANV1, N, N, N, ONE, RES, LDRES, V1, LDV1, ZERO, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANA,TRANV1,ONE,RES[1:N,1:N],V1[1:N,1:N],ZERO,view(RES,1:N,4*N+1:5N))
# interp call 12
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, -ONE, RES(1,2*N+1), LDRES, V2, LDV2, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!('N','T',-ONE,RES[1:N,2*N+1:3N],V2[1:N,1:N],ONE,view(RES,1:N,4*N+1:5N))
# interp call 13
#FOREIGN.dgemm!( TRANA, TRANA, N, N, N, -ONE, U1, LDU1, A, LDA, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANA,TRANA,-ONE,U1[1:N,1:N],A[1:N,1:N],ONE,view(RES,1:N,4*N+1:5N))
#TEMP = DLANGE( 'Frobenius', N, N, RES(1,4*N+1), LDRES, DWORK )
TEMP = norm(RES[1:N,4*N+1:5N])
# interp call 14
#FOREIGN.dgemm!( TRANA, 'Transpose', N, N, N, ONE, RES, LDRES, V2, LDV2, ZERO, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANA,'T',ONE,RES[1:N,1:N],V2[1:N,1:N],ZERO,view(RES,1:N,4*N+1:5N))
# interp call 15
#FOREIGN.dgemm!( 'No Transpose', TRANV1, N, N, N, ONE, RES(1,2*N+1), LDRES, V1, LDV1, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!('N',TRANV1,ONE,RES[1:N,2*N+1:3N],V1[1:N,1:N],ONE,view(RES,1:N,4*N+1:5N))
# interp call 16
#FOREIGN.dgemm!( TRANA, 'No Transpose', N, N, N, -ONE, U1, LDU1, G, LDG, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANA,'N',-ONE,U1[1:N,1:N],G[1:N,1:N],ONE,view(RES,1:N,4*N+1:5N))
# interp call 17
#FOREIGN.dgemm!( 'No Transpose', TRANB, N, N, N, -ONE, U2, LDU2, B, LDB, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!('N',TRANB,-ONE,U2[1:N,1:N],B[1:N,1:N],ONE,view(RES,1:N,4*N+1:5N))
#TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES(1,4*N+1), LDRES, DWORK ) )
TEMP = hypot(TEMP,norm(RES[1:N,4*N+1:5N]))
# interp call 18
#FOREIGN.dgemm!( 'No Transpose', TRANV1, N, N, N, ONE, RES(1,3*N+1), LDRES, V1, LDV1, ZERO, RES(1,4*N+1), LDRES )
BLAS.gemm!('N',TRANV1,ONE,RES[1:N,3*N+1:4N],V1[1:N,1:N],ZERO,view(RES,1:N,4*N+1:5N))
# interp call 19
#FOREIGN.dgemm!( TRANB, 'Transpose', N, N, N, -ONE, RES(1,N+1), LDRES, V2, LDV2, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANB,'T',-ONE,RES[1:N,N+1:2N], V2[1:N,1:N],ONE,view(RES,1:N,4*N+1:5N))
# interp call 20
#FOREIGN.dgemm!( 'No Transpose', TRANA, N, N, N, ONE, U2, LDU2, A, LDA, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!('N',TRANA,ONE,U2[1:N,1:N],A[1:N,1:N],ONE,view(RES,1:N,4*N+1:5N))
#TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES(1,4*N+1), LDRES, DWORK ) )
TEMP = hypot(TEMP,norm(RES[1:N,4*N+1:5N]))
# interp call 21
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, ONE, RES(1,3*N+1), LDRES, V2, LDV2, ZERO, RES(1,4*N+1), LDRES )
BLAS.gemm!('N','T',ONE,RES[1:N,3*N+1:4N],V2[1:N,1:N],ZERO,view(RES,1:N,4*N+1:5N))
# interp call 22
#FOREIGN.dgemm!( TRANB, TRANV1, N, N, N, ONE, RES(1,N+1), LDRES, V1, LDV1, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANB,TRANV1,ONE,RES[1:N,N+1:2N],V1[1:N,1:N],ONE,view(RES,1:N,4*N+1:5N))
# interp call 23
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, U2, LDU2, G, LDG, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!('N','N',ONE,U2[1:N,1:N],G[1:N,1:N],ONE,view(RES,1:N,4*N+1:5N))
# interp call 24
#FOREIGN.dgemm!( TRANA, TRANB, N, N, N, -ONE, U1, LDU1, B, LDB, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANA,TRANB,-ONE,U1[1:N,1:N],B[1:N,1:N],ONE,view(RES,1:N,4*N+1:5N))
#TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES(1,4*N+1), LDRES, DWORK ) )
TEMP = hypot(TEMP,norm(RES[1:N,4*N+1:5N]))
println(io, "residual H V - U R norm: $TEMP")
@test TEMP < 1e-12
if ( LSAME( TRANB, 'N' ) )
# interp output 7
_nc = N
_nr = N
println(io, "V1:")
show(io, "text/plain", V1[1:_nr,1:_nc])
println(io)
println(io, "V2:")
show(io, "text/plain", V2[1:_nr,1:_nc])
println(io)
# unable to translate write statement:
# write MA02JD( .TRUE., .TRUE., N, V1, LDV1, V2, LDV2, RES(1,4*N+1), LDRES )
resnorm = SLICOT.ma02jd!(true,true,N,V1,V2)
println(io, "V orth. residual norm = $resnorm")
@test resnorm < 1e-12
else
# interp output 8
_nc = N
_nr = N
println(io, "V1:")
show(io, "text/plain", V1[1:_nr,1:_nc])
println(io)
println(io, "V2:")
show(io, "text/plain", V1[1:_nr,1:_nc])
println(io)
# unable to translate write statement:
# write MA02JD( .FALSE., .TRUE., N, V1, LDV1, V2, LDV2, RES(1,4*N+1), LDRES )
resnorm = SLICOT.ma02jd!(false,true,N,V1,V2)
println(io, "V orth. residual norm = $resnorm")
@test resnorm < 1e-12
end # if
end # run_mb04tb()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 10323 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04ts(datfile, io=stdout)
ZERO = 0.0e0
ONE = 1.0e0
NIN = 5
NOUT = 6
NMAX = 200
LDA = NMAX
LDB = NMAX
LDG = NMAX
LDQ = NMAX
LDRES = NMAX
LDU1 = NMAX
LDU2 = NMAX
LDV1 = NMAX
LDV2 = NMAX
LDWORK = NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
B = Array{Float64,2}(undef, LDB,NMAX)
G = Array{Float64,2}(undef, LDG,NMAX)
Q = Array{Float64,2}(undef, LDQ,NMAX)
CSL = Array{Float64,1}(undef, 2*NMAX)
CSR = Array{Float64,1}(undef, 2*NMAX)
TAUL = Array{Float64,1}(undef, NMAX)
TAUR = Array{Float64,1}(undef, NMAX)
U1 = Array{Float64,2}(undef, LDU1,NMAX)
U2 = Array{Float64,2}(undef, LDU2,NMAX)
V1 = Array{Float64,2}(undef, LDV1,NMAX)
V2 = Array{Float64,2}(undef, LDV2,NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
RES = Array{Float64,2}(undef, LDRES,5*NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
TRANA = vs[2][1]
TRANB = vs[3][1]
if ( N<=0 || N>NMAX )
@error "illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
RES[1:N,1:N] .= A[1:N,1:N]
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
#FOREIGN.dlacpy!( 'All', N, N, B, LDB, RES(1,N+1), LDRES )
RES[1:N,N+1:2N] .= B[1:N,1:N]
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
G[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 2
#FOREIGN.dlacpy!( 'All', N, N, G, LDG, RES(1,2*N+1), LDRES )
RES[1:N,2N+1:3N] .= G[1:N,1:N]
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
Q[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 3
#FOREIGN.dlacpy!( 'All', N, N, Q, LDQ, RES(1,3*N+1), LDRES )
RES[1:N,3N+1:4N] .= Q[1:N,1:N]
close(f)
# interp call 4
INFO = SLICOT.mb04ts!(TRANA, TRANB, N, 1, A, B, G, Q, CSL, CSR, TAUL, TAUR, LDWORK)
@test INFO == 0
if ( INFO!=0 )
@warn "mb04ts returned info=$INFO"
return
end
U1[1:N,1:N] .= A[1:N,1:N]
U2[1:N,1:N] .= Q[1:N,1:N]
# interp call 5
INFO = SLICOT.mb04wr!('U', TRANA, N, 1, U1, U2, CSL, TAUL)
@test INFO == 0
if ( INFO!=0 )
@warn "mb04wr returned info=$INFO"
return
end
V2[1:N,1:N] .= Q[1:N,1:N]
V1[1:N,1:N] .= B[1:N,1:N]
# interp call 6
INFO = SLICOT.mb04wr!('V', TRANB, N, 1, V1, V2, CSR, TAUR)
@test INFO == 0
if ( INFO!=0 )
@warn "mb04wr returned info=$INFO"
return
end
# interp output 1
_nc = N
_nr = N
println(io, "U1:")
show(io, "text/plain", U1[1:_nr,1:_nc])
println(io)
println(io, "U2:")
show(io, "text/plain", U2[1:_nr,1:_nc])
println(io)
if ( LSAME( TRANA, 'N' ) )
resnorm = SLICOT.ma02jd!(false,false,N,U1,U2)
println(io, "U orth. residual norm = $resnorm")
@test resnorm < 1e-12
# unable to translate write statement:
# write MA02JD( .FALSE., .FALSE., N, U1, LDU1, U2, LDU2, RES(1,4*N+1), LDRES )
else
resnorm = SLICOT.ma02jd!(true,false,N,U1,U2)
println(io, "U orth. residual norm = $resnorm")
@test resnorm < 1e-12
# unable to translate write statement:
# write MA02JD( .TRUE., .FALSE., N, U1, LDU1, U2, LDU2, RES(1,4*N+1), LDRES )
end # if
# interp call 7
#FOREIGN.dlaset!( 'All', N, N, ZERO, ZERO, Q, LDQ )
Q[1:N,1:N] .= ZERO
if ( LSAME( TRANA, 'N' ) )
# interp call 8
#FOREIGN.dlaset!( 'Lower', N-1, N-1, ZERO, ZERO, A(2,1), LDA )
triu!(view(A,1:N,1:N-1))
# interp output 3
_nc = N
_nr = N
println(io, "A:")
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
println(io, "G:")
show(io, "text/plain", G[1:_nr,1:_nc])
println(io)
else
# interp call 9
#FOREIGN.dlaset!( 'Upper', N-1, N-1, ZERO, ZERO, A(1,2), LDA )
tril!(view(A,1:N,1:N-1))
# interp output 4
_nc = N
_nr = N
println(io, "A:")
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
println(io, "G:")
show(io, "text/plain", G[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( TRANB, 'N' ) )
if ( N>1 )
# interp call 10
#FOREIGN.dlaset!( 'Upper', N-2, N-2, ZERO, ZERO, B(1,3), LDB )
tril!(view(B,1:N-1,2:N))
end # if
# interp output 5
_nc = N
_nr = N
println(io, "Q:")
show(io, "text/plain", Q[1:_nr,1:_nc])
println(io)
println(io, "B:")
show(io, "text/plain", B[1:_nr,1:_nc])
println(io)
else
if ( N>1 )
# interp call 11
#FOREIGN.dlaset!( 'Lower', N-2, N-2, ZERO, ZERO, B(3,1), LDB )
triu!(view(B,2:N-1,1:N-2))
end # if
# interp output 6
_nc = N
_nr = N
println(io, "Q:")
show(io, "text/plain", Q[1:_nr,1:_nc])
println(io)
println(io, "B:")
show(io, "text/plain", B[1:_nr,1:_nc])
println(io)
end # if
if ( LSAME( TRANB, 'N' ) )
TRANV1 = 'T'
else
TRANV1 = 'N'
end # if
# interp call 12
#FOREIGN.dgemm!( TRANA, TRANV1, N, N, N, ONE, RES, LDRES, V1, LDV1, ZERO, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANA,TRANV1,ONE,RES[1:N,1:N],V1[1:N,1:N],ZERO,view(RES,1:N,4N+1:5N))
# interp call 13
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, -ONE, RES(1,2*N+1), LDRES, V2, LDV2, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!('N','T',-ONE,RES[1:N,2N+1:3N],V2[1:N,1:N],ONE,view(RES,1:N,4N+1:5N))
# interp call 14
#FOREIGN.dgemm!( TRANA, TRANA, N, N, N, -ONE, U1, LDU1, A, LDA, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANA,TRANA,-ONE,U1[1:N,1:N],A[1:N,1:N],ONE,view(RES,1:N,4N+1:5N))
#TEMP = DLANGE( 'Frobenius', N, N, RES(1,4*N+1), LDRES, DWORK )
TEMP = norm(RES[1:N,4N+1:5N])
# interp call 15
#FOREIGN.dgemm!( TRANA, 'Transpose', N, N, N, ONE, RES, LDRES, V2, LDV2, ZERO, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANA,'T',ONE,RES[1:N,1:N],V2[1:N,1:N],ZERO,view(RES,1:N,4N+1:5N))
# interp call 16
#FOREIGN.dgemm!( 'No Transpose', TRANV1, N, N, N, ONE, RES(1,2*N+1), LDRES, V1, LDV1, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!('N',TRANV1,ONE,RES[1:N,2N+1:3N],V1[1:N,1:N],ONE,view(RES,1:N,4N+1:5N))
# interp call 17
#FOREIGN.dgemm!( TRANA, 'No Transpose', N, N, N, -ONE, U1, LDU1, G, LDG, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANA,'N',-ONE,U1[1:N,1:N],G[1:N,1:N],ONE,view(RES,1:N,4N+1:5N))
# interp call 18
#FOREIGN.dgemm!( 'No Transpose', TRANB, N, N, N, -ONE, U2, LDU2, B, LDB, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!('N',TRANB,-ONE,U2[1:N,1:N],B[1:N,1:N],ONE,view(RES,1:N,4N+1:5N))
#TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES(1,4*N+1), LDRES, DWORK ) )
TEMP = hypot(TEMP,norm(RES[1:N,4N+1:5N]))
# interp call 19
#FOREIGN.dgemm!( 'No Transpose', TRANV1, N, N, N, ONE, RES(1,3*N+1), LDRES, V1, LDV1, ZERO, RES(1,4*N+1), LDRES )
BLAS.gemm!('N',TRANV1,ONE,RES[1:N,3N+1:4N],V1[1:N,1:N],ZERO,view(RES,1:N,4N+1:5N))
# interp call 20
#FOREIGN.dgemm!( TRANB, 'Transpose', N, N, N, -ONE, RES(1,N+1), LDRES, V2, LDV2, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANB,'T',-ONE,RES[1:N,N+1:2N],V2[1:N,1:N],ONE,view(RES,1:N,4N+1:5N))
# interp call 21
#FOREIGN.dgemm!( 'No Transpose', TRANA, N, N, N, ONE, U2, LDU2, A, LDA, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!('N',TRANA,ONE,U2[1:N,1:N],A[1:N,1:N],ONE,view(RES,1:N,4N+1:5N))
#TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES(1,4*N+1), LDRES, DWORK ) )
TEMP = hypot(TEMP, norm(RES[1:N,4N+1:5N]))
# interp call 22
#FOREIGN.dgemm!( 'No Transpose', 'Transpose', N, N, N, ONE, RES(1,3*N+1), LDRES, V2, LDV2, ZERO, RES(1,4*N+1), LDRES )
BLAS.gemm!('N','T',ONE,RES[1:N,3N+1:4N],V2[1:N,1:N],ZERO,view(RES,1:N,4N+1:5N))
# interp call 23
#FOREIGN.dgemm!( TRANB, TRANV1, N, N, N, ONE, RES(1,N+1), LDRES, V1, LDV1, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANB,TRANV1,ONE,RES[1:N,N+1:2N],V1[1:N,1:N],ONE,view(RES,1:N,4N+1:5N))
# interp call 24
#FOREIGN.dgemm!( 'No Transpose', 'No Transpose', N, N, N, ONE, U2, LDU2, G, LDG, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!('N','N',ONE,U2[1:N,1:N],G[1:N,1:N],ONE,view(RES,1:N,4N+1:5N))
# interp call 25
#FOREIGN.dgemm!( TRANA, TRANB, N, N, N, -ONE, U1, LDU1, B, LDB, ONE, RES(1,4*N+1), LDRES )
BLAS.gemm!(TRANA,TRANB,-ONE,U1[1:N,1:N],B[1:N,1:N],ONE,view(RES,1:N,4N+1:5N))
#TEMP = DLAPY2( TEMP, DLANGE( 'Frobenius', N, N, RES(1,4*N+1), LDRES, DWORK ) )
TEMP = hypot(TEMP, norm(RES[1:N,4N+1:5N]))
println(io, "residual H V - U R norm = $TEMP")
@test TEMP < 1e-12
# interp output 7
_nc = N
_nr = N
println(io, "V1:")
show(io, "text/plain", V1[1:_nr,1:_nc])
println(io)
println(io, "V2:")
show(io, "text/plain", V2[1:_nr,1:_nc])
println(io)
if ( LSAME( TRANB, 'N' ) )
# unable to translate write statement:
# write MA02JD( .TRUE., .TRUE., N, V1, LDV1, V2, LDV2, RES(1,4*N+1), LDRES )
resnorm = SLICOT.ma02jd!(true,true,N,V1,V2)
println(io, "V orth. residual norm = $resnorm")
@test resnorm < 1e-12
else
# unable to translate write statement:
# write MA02JD( .FALSE., .TRUE., N, V1, LDV1, V2, LDV2, RES(1,4*N+1), LDRES )
resnorm = SLICOT.ma02jd!(false,true,N,V1,V2)
println(io, "V orth. residual norm = $resnorm")
@test resnorm < 1e-12
end # if
end # run_mb04ts()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1958 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04ud(datfile, io=stdout)
NIN = 5
NOUT = 6
MMAX = 20
NMAX = 20
LDA = MMAX
LDE = MMAX
LDQ = MMAX
LDZ = NMAX
LDWORK = max( NMAX,MMAX )
A = Array{Float64,2}(undef, LDA,NMAX)
E = Array{Float64,2}(undef, LDE,NMAX)
Q = Array{Float64,2}(undef, LDQ,MMAX)
Z = Array{Float64,2}(undef, LDZ,NMAX)
ISTAIR = Array{BlasInt,1}(undef, MMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
M = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
TOL = parse(Float64, replace(vs[3],'D'=>'E'))
if ( M<0 || M>MMAX )
elseif ( N<0 || N>NMAX )
else
vs = String[]
_isz,_jsz = (M,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
E[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
JOBQ = 'N'
JOBZ = 'N'
# interp call 1
RANKE, INFO = SLICOT.mb04ud!(JOBQ, JOBZ, M, N, A, E, Q, Z, ISTAIR, TOL)
println(io, "RANKE = $RANKE")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
# interp output 1
println(io,"A:")
_nc = N
_nr = M
show(io,"text/plain",A[1:_nr,1:_nc])
println(io,)
# interp output 2
println(io,"E:")
_nc = N
_nr = M
show(io,"text/plain",E[1:_nr,1:_nc])
println(io,)
# interp output 3
println(io,"ISTAIR:")
_nr = M
show(io,"text/plain",ISTAIR[1:_nr])
println(io,)
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3515 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04vd(datfile, io=stdout)
NIN = 5
NOUT = 6
MMAX = 20
NMAX = 20
LDA = MMAX
LDE = MMAX
LDQ = MMAX
LDZ = NMAX
LINUK = max( NMAX,MMAX+1 )
LIWORK = NMAX
LDWORK = max( NMAX,MMAX )
ZERO = 0.0e0
ONE = 1.0e0
A = Array{Float64,2}(undef, LDA,NMAX)
E = Array{Float64,2}(undef, LDE,NMAX)
Q = Array{Float64,2}(undef, LDQ,MMAX)
Z = Array{Float64,2}(undef, LDZ,NMAX)
ISTAIR = Array{BlasInt,1}(undef, MMAX)
# WARNING: desperate attempt to initialize NBLCKS
NBLCKS = 0
# WARNING: desperate attempt to initialize NBLCKI
NBLCKI = 0
IMUK = Array{BlasInt,1}(undef, LINUK)
INUK = Array{BlasInt,1}(undef, LINUK)
IMUK0 = Array{BlasInt,1}(undef, NMAX)
MNEI = Array{BlasInt,1}(undef, 3)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, LIWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
M = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
TOL = parse(Float64, replace(vs[3],'D'=>'E'))
MODE = vs[4][1]
if ( M<0 || M>MMAX )
@error "Illegal M=$M"
end
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (M,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (M,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
E[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
JOBQ = 'I'
JOBZ = 'I'
# interp call 1
RANKE, INFO = SLICOT.mb04ud!(JOBQ, JOBZ, M, N, A, E, Q, Z, ISTAIR, TOL)
println(io, "RANKE = $RANKE")
@test INFO == 0
INFO == 0 || return
JOBQ = 'U'
JOBZ = 'U'
# interp call 2
NBLCKS, NBLCKI, INFO = SLICOT.mb04vd!(MODE, JOBQ, JOBZ, M, N, RANKE, A, E, Q, Z, ISTAIR,
IMUK, INUK, IMUK0, MNEI, TOL)
@test INFO == 0
INFO == 0 || return
# interp output 1
println(io, "Q:")
_nc = M
_nr = M
show(io, "text/plain", Q[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "E:")
_nc = N
_nr = M
show(io, "text/plain", E[1:_nr,1:_nc])
println(io)
# interp output 3
println(io, "A:")
_nc = N
_nr = M
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 4
println(io, "Z:")
_nc = N
_nr = N
show(io, "text/plain", Z[1:_nr,1:_nc])
println(io)
if ( ! LSAME( MODE, 'S' ) )
# interp output 5
println(io, "IMUK:")
_nr = NBLCKS
show(io, "text/plain", IMUK[1:_nr])
println(io)
# interp output 6
println(io, "INUK:")
_nr = NBLCKS
show(io, "text/plain", INUK[1:_nr])
println(io)
else
# interp output 7
println(io, "IMUK:")
_nr = NBLCKS
show(io, "text/plain", IMUK[1:_nr])
println(io)
# interp output 8
println(io, "INUK:")
_nr = NBLCKS
show(io, "text/plain", INUK[1:_nr])
println(io)
# interp output 9
println(io, "IMUK0:")
_nr = NBLCKI
show(io, "text/plain", IMUK0[1:_nr])
println(io)
# interp output 10
println(io, "MNEI:")
_nr = 3
show(io, "text/plain", MNEI[1:_nr])
println(io)
end # if
end # run_mb04vd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2709 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04xd(datfile, io=stdout)
ZERO = 0.0e0
NIN = 5
NOUT = 6
MMAX = 20
NMAX = 20
LDA = MMAX
LDU = MMAX
LDV = NMAX
MAXMN = max( MMAX, NMAX )
MNMIN = min( MMAX, NMAX )
LENGQ = 2*MNMIN-1
LDWORK = max( 2*NMAX, NMAX*( NMAX+1 )÷2 ) + max( 2*MNMIN + MAXMN, 8*MNMIN - 5 )
A = Array{Float64,2}(undef, LDA,NMAX)
U = Array{Float64,2}(undef, LDU,MMAX)
V = Array{Float64,2}(undef, LDV,NMAX)
Q = Array{Float64,1}(undef, LENGQ)
INUL = Array{BlasBool,1}(undef, MAXMN)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
M = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
RANK = parse(BlasInt, vs[3])
THETA = parse(Float64, replace(vs[4],'D'=>'E'))
TOL = parse(Float64, replace(vs[5],'D'=>'E'))
RELTOL = parse(Float64, replace(vs[6],'D'=>'E'))
JOBU = vs[7][1]
JOBV = vs[8][1]
if ( M<0 || M>MMAX )
elseif ( N<0 || N>NMAX )
elseif ( RANK>MNMIN )
elseif ( RANK<0 && THETA<ZERO )
else
vs = String[]
_isz,_jsz = (M,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
RANK1 = RANK
THETA1 = THETA
# interp call 1
INUL .= 0
RANK, THETA, INFO, IWARN = SLICOT.mb04xd!(JOBU, JOBV, M, N, RANK, THETA, A, U, V, Q, INUL, TOL, RELTOL)
println(io, "RANK = $RANK")
println(io, "THETA = $THETA")
@test INFO == 0
INFO == 0 || return
println(io, "IWARN = $IWARN")
inul = convert(Vector{Bool},INUL)
if ( INFO!=0 )
else
if ( IWARN!=0 )
else
end # if
LJOBUA = LSAME( JOBU, 'A' )
LJOBUS = LSAME( JOBU, 'S' )
LJOBVA = LSAME( JOBV, 'A' )
LJOBVS = LSAME( JOBV, 'S' )
WANTU = LJOBUA||LJOBUS
WANTV = LJOBVA||LJOBVS
MINMN = min( M, N )
LOOP = MINMN - 1
println(io, "Q:")
show(io, "text/plain", Bidiagonal(Q[1:MINMN],Q[MINMN+1:MINMN+LOOP],'U'))
println(io)
if ( WANTU )
NCOLU = LJOBUS ? MINMN : M
# interp output 1
println(io, "U:")
_nc = NCOLU
_nr = M
show(io, "text/plain", U[1:_nr,1:_nc])
println(io)
println(io, "INUL:")
show(io, "text/plain", inul[1:NCOLU])
println(io)
end # if
if ( WANTV )
NCOLV = LJOBVS ? MINMN : N
# interp output 2
println(io, "V:")
_nc = NCOLV
_nr = N
show(io, "text/plain", V[1:_nr,1:_nc])
println(io)
println(io, "INUL:")
show(io, "text/plain", inul[1:NCOLV])
println(io)
end # if
end # if
end # if
close(f)
end # run_mb04xd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3137 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04yd(datfile, io=stdout)
ZERO = 0.0e0
NIN = 5
NOUT = 6
MMAX = 20
NMAX = 20
MNMIN = min( MMAX, NMAX )
LDU = MMAX
LDV = NMAX
LDWORK = 6*MNMIN - 5
Q = Array{Float64,1}(undef, MNMIN)
E = Array{Float64,1}(undef, MNMIN-1)
U = Array{Float64,2}(undef, LDU,MNMIN)
V = Array{Float64,2}(undef, LDV,MNMIN)
INUL = Array{BlasBool,1}(undef, MNMIN)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
M = parse(BlasInt, vs[1])
N = parse(BlasInt, vs[2])
THETA = parse(Float64, replace(vs[3],'D'=>'E'))
RANK = parse(BlasInt, vs[4])
TOL = parse(Float64, replace(vs[5],'D'=>'E'))
RELTOL = parse(Float64, replace(vs[6],'D'=>'E'))
JOBU = vs[7][1]
JOBV = vs[8][1]
MINMN = min( M, N )
if ( M<0 || M>MMAX )
elseif ( N<0 || N>NMAX )
elseif ( RANK>MINMN )
elseif ( RANK<0 && THETA<ZERO )
else
vs = String[]
_isz = MINMN
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
Q[1:_isz] .= parsex.(Float64, vs)
vs = String[]
_isz = MINMN-1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
E[1:_isz] .= parsex.(Float64, vs)
RANK1 = RANK
LJOBUU = LSAME( JOBU, 'U' )
LJOBVU = LSAME( JOBV, 'U' )
# CHECKME: partly translated condition
if LJOBUU
vs = String[]
_isz,_jsz = (M,MINMN)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
U[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end
# CHECKME: partly translated condition
if LJOBVU
vs = String[]
_isz,_jsz = (N,MINMN)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
V[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
end
INUL .= false
# CHECKME: partly translated condition
if LJOBUU||LJOBVU
vs = String[]
_isz = MINMN
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
INUL[1:_isz] .= parsex.(Bool, vs)
end
# interp call 1
RANK, THETA, INFO, IWARN = SLICOT.mb04yd!(JOBU, JOBV, M, N, RANK, THETA, Q, E, U, V, INUL, TOL, RELTOL, LDWORK)
println(io, "RANK = $RANK")
println(io, "THETA = $THETA")
@test INFO == 0
INFO == 0 || return
println(io, "IWARN = $IWARN")
if ( INFO!=0 )
else
if ( IWARN!=0 )
end # if
if ( !LSAME( JOBV, 'N' ) )
# interp output 1
println(io,"V:")
_nc = MINMN
_nr = N
show(io,"text/plain",V[1:_nr,1:_nc])
println(io,)
end # if
if ( !LSAME( JOBU, 'N' ) )
# interp output 2
println(io,"U:")
_nc = MINMN
_nr = M
show(io,"text/plain",U[1:_nr,1:_nc])
println(io,)
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2467 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb04zd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
LDA = NMAX
LDQG = NMAX
LDU = NMAX
LDWORK = ( NMAX+NMAX )*( NMAX+NMAX+1 )
ZERO = 0.0e0
ONE = 1.0e0
A = Array{Float64,2}(undef, LDA,NMAX)
QG = Array{Float64,2}(undef, LDQG,NMAX+1)
U = Array{Float64,2}(undef, LDU,NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
COMPU = vs[2][1]
if ( N<0 || N>NMAX )
@error "Illegal N=$N"
return
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*(_jsz+1)÷2
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
_i0 = 0
for j in 1:_jsz
QG[j,j+1:_jsz+1] .= parsex.(Float64, vs[_i0+1:_i0+_jsz-j+1])
_i0 += _jsz-j+1
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*(_jsz+1)÷2
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
_i0 = 0
for j in 1:_jsz
QG[j:_jsz,j] .= parsex.(Float64, vs[_i0+1:_i0+_jsz-j+1])
_i0 += _jsz-j+1
end
close(f)
# interp call 1
INFO = SLICOT.mb04zd!(COMPU, N, A, QG, U)
@test INFO == 0
INFO != 0 && return
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "QG:")
_nc = N
_nr = N+1
show(io, "text/plain", QG[1:_nr,1:_nc])
println(io)
Ht = zeros(2N,2N)
for i in 1:N
Ht[:,i] .= vcat(A[i,1:N],QG[1:i-1,i+1],QG[i,i+1:N+1])
Ht[:,N+i] .= vcat(QG[i,1:i-1],QG[i:N,i],-A[1:N,i])
end
H = Matrix(Ht')
println(io, "sq. reduced Hamiltonian:")
show(io, "text/plain", H)
println(io)
# the original does this w/ BLAS in bits, but why bother?
Hsq = H*H
println(io, "squared sq. reduced Hamiltonian:")
show(io, "text/plain", Hsq)
println(io)
llquadres = norm(Hsq[N+1:N,1:N])
@test llquadres < 1e-12
A2_hess_err = norm(tril(Hsq[1:N,1:N],-2))
@test A2_hess_err < 1e-12
end # run_mb04zd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1742 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb05md(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
LDA = NMAX
LDV = NMAX
LDY = NMAX
LDWORK = 4*NMAX
A = Array{Float64,2}(undef, LDA,NMAX)
V = Array{Float64,2}(undef, LDV,NMAX)
Y = Array{Float64,2}(undef, LDY,NMAX)
VALR = Array{Float64,1}(undef, NMAX)
VALI = Array{Float64,1}(undef, NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, NMAX)
f = open(datfile,"r")
readline(f)
BALANC = 'N'
vs = split(readline(f))
N = parse(BlasInt, vs[1])
DELTA = parse(Float64, replace(vs[2],'D'=>'E'))
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
INFO = SLICOT.mb05md!(BALANC, N, DELTA, A, V, Y, VALR, VALI, LDWORK)
@test INFO == 0
INFO == 0 || return
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# unable to translate write loop:
# write (I), VALI(I), I = 1,N
# interp output 2
println(io, "eigvals:")
show(io, "text/plain", VALR[1:N]+im*VALI[1:N])
println(io)
# interp output 3
println(io, "V:")
_nc = N
_nr = N
show(io, "text/plain", V[1:_nr,1:_nc])
println(io)
# interp output 4
println(io, "Y:")
_nc = N
_nr = N
show(io, "text/plain", Y[1:_nr,1:_nc])
println(io)
end # run_mb05md()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1411 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb05nd(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
LDA = NMAX
LDEX = NMAX
LDEXIN = NMAX
LDWORK = NMAX*( NMAX+1 )
A = Array{Float64,2}(undef, LDA,NMAX)
EX = Array{Float64,2}(undef, LDEX,NMAX)
EXINT = Array{Float64,2}(undef, LDEXIN,NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
DELTA = parse(Float64, replace(vs[2],'D'=>'E'))
TOL = parse(Float64, replace(vs[3],'D'=>'E'))
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
INFO = SLICOT.mb05nd!(N, DELTA, A, EX, EXINT, TOL, LDWORK)
@test INFO == 0
INFO == 0 || return
# interp output 1
println(io, "EX:")
_nc = N
_nr = N
show(io, "text/plain", EX[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "EXINT:")
_nc = N
_nr = N
show(io, "text/plain", EXINT[1:_nr,1:_nc])
println(io)
end # run_mb05nd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1321 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb05od(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 20
LDA = NMAX
NDIAG = 9
LDWORK = NMAX*( 2*NMAX+NDIAG+1 )+NDIAG
A = Array{Float64,2}(undef, LDA,NMAX)
DWORK = Array{Float64,1}(undef, LDWORK)
IWORK = Array{BlasInt,1}(undef, NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
DELTA = parse(Float64, replace(vs[2],'D'=>'E'))
BALANC = vs[3][1]
if ( N<=0 || N>NMAX )
else
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(Float64, vs[_i0+1:_i0+_jsz])
end
# interp call 1
MDIG, IDIG, INFO, IWARN = SLICOT.mb05od!(BALANC, N, NDIAG, DELTA, A, LDWORK)
println(io, "MDIG = $MDIG")
println(io, "IDIG = $IDIG")
@test INFO == 0
INFO == 0 || return
println(io, "IWARN = $IWARN")
if ( INFO!=0 )
else
# interp output 1
println(io,"A:")
_nc = N
_nr = N
show(io,"text/plain",A[1:_nr,1:_nc])
println(io,)
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 2522 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb4dlz(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 10
LDA = NMAX
LDB = NMAX
A = Array{ComplexF64,2}(undef, LDA,NMAX)
B = Array{ComplexF64,2}(undef, LDB,NMAX)
DWORK = Array{Float64,1}(undef, 8*NMAX)
LSCALE = Array{Float64,1}(undef, NMAX)
RSCALE = Array{Float64,1}(undef, NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
JOB = vs[2][1]
THRESH = parse(Float64, replace(vs[3],'D'=>'E'))
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
B[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
ILO, IHI, INFO, IWARN = SLICOT.mb4dlz!( JOB, N, THRESH, A, B,
LSCALE, RSCALE, DWORK)
@test INFO == 0
INFO == 0 || return
println(io, "ILO = $ILO")
println(io, "IHI = $IHI")
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "B:")
_nc = N
_nr = N
show(io, "text/plain", B[1:_nr,1:_nc])
println(io)
# interp output 3
println(io, "LSCALE:")
_nr = N
show(io, "text/plain", LSCALE[1:_nr])
println(io)
# interp output 4
println(io, "RSCALE:")
_nr = N
show(io, "text/plain", RSCALE[1:_nr])
println(io)
if ( LSAME( JOB, 'S' ) || LSAME( JOB, 'B' ) )
if ( !( THRESH==-2 || THRESH==-4 ) )
# interp output 5
println(io, "initial 1-norms:")
_nr = 2
show(io, "text/plain", DWORK[1:_nr])
println(io)
println(io, "final 1-norms:")
show(io, "text/plain", DWORK[3:4])
println(io)
# interp output 7
println(io, "final threshold:")
show(io, "text/plain", DWORK[5])
println(io)
else
@warn "mb4dlz returned iwarn=$IWARN"
end
end
end # run_mb4dlz()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 3365 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mb4dpz(datfile, io=stdout)
NIN = 5
NOUT = 6
NMAX = 10
LDA = NMAX
LDC = NMAX
LDDE = NMAX
LDVW = NMAX
A = Array{ComplexF64,2}(undef, LDA,NMAX)
C = Array{ComplexF64,2}(undef, LDC,NMAX)
DE = Array{ComplexF64,2}(undef, LDDE,NMAX)
VW = Array{ComplexF64,2}(undef, LDVW,NMAX)
DWORK = Array{Float64,1}(undef, 8*NMAX)
LSCALE = Array{Float64,1}(undef, NMAX)
RSCALE = Array{Float64,1}(undef, NMAX)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
N = parse(BlasInt, vs[1])
JOB = vs[2][1]
THRESH = parse(Float64, replace(vs[3],'D'=>'E'))
if ( N<=0 || N>NMAX )
@error "Illegal N=$N"
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
A[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
DE[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
C[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
vs = String[]
_isz,_jsz = (N,N+1)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
_i0 = (i-1)*_jsz
VW[i,1:_jsz] .= parsex.(ComplexF64, vs[_i0+1:_i0+_jsz])
end
close(f)
# interp call 1
ILO, INFO, IWARN = SLICOT.mb4dpz!( JOB, N, THRESH, A, DE, C, VW, LSCALE, RSCALE, DWORK)
@test INFO == 0
INFO == 0 || return
# interp output 1
println(io, "A:")
_nc = N
_nr = N
show(io, "text/plain", A[1:_nr,1:_nc])
println(io)
# interp output 2
println(io, "DE:")
_nc = N+1
_nr = N
show(io, "text/plain", DE[1:_nr,1:_nc])
println(io)
# interp output 3
println(io, "C:")
_nc = N
_nr = N
show(io, "text/plain", C[1:_nr,1:_nc])
println(io)
# interp output 4
println(io, "VW:")
_nc = N+1
_nr = N
show(io, "text/plain", VW[1:_nr,1:_nc])
println(io)
println(io, "ILO = $ILO")
# interp output 5
println(io, "LSCALE:")
_nr = N
show(io, "text/plain", LSCALE[1:_nr])
println(io)
# interp output 6
println(io, "RSCALE:")
_nr = N
show(io, "text/plain", RSCALE[1:_nr])
println(io)
if ( LSAME( JOB, 'S' ) || LSAME( JOB, 'B' ) )
if ( !( THRESH==-2 || THRESH==-4 ) )
# interp output 5
println(io, "initial 1-norms:")
_nr = 2
show(io, "text/plain", DWORK[1:_nr])
println(io)
println(io, "final 1-norms:")
show(io, "text/plain", DWORK[3:4])
println(io)
# interp output 7
println(io, "final threshold:")
show(io, "text/plain", DWORK[5])
println(io)
else
@warn "mb4dlz returned iwarn=$IWARN"
end
end
end # run_mb4dpz()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 883 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mc01md(datfile, io=stdout)
NIN = 5
NOUT = 6
DPMAX = 20
P = Array{Float64,1}(undef, DPMAX+1)
Q = Array{Float64,1}(undef, DPMAX+1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
DP = parse(BlasInt, vs[1])
ALPHA = parse(Float64, replace(vs[2],'D'=>'E'))
K = parse(BlasInt, vs[3])
if ( DP<=-1 || DP>DPMAX )
else
vs = String[]
_isz = DP+1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
P[1:_isz] .= parsex.(Float64, vs)
# interp call 1
INFO = SLICOT.mc01md!(DP, ALPHA, K, P, Q)
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 917 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mc01nd(datfile, io=stdout)
NIN = 5
NOUT = 6
DPMAX = 20
P = Array{Float64,1}(undef, DPMAX+1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
DP = parse(BlasInt, vs[1])
XR = parse(Float64, replace(vs[2],'D'=>'E'))
XI = parse(Float64, replace(vs[3],'D'=>'E'))
if ( DP<=-1 || DP>DPMAX )
else
vs = String[]
_isz = DP+1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
P[1:_isz] .= parsex.(Float64, vs)
# interp call 1
VR, VI, INFO = SLICOT.mc01nd!(DP, XR, XI, P)
println(io, "VR = $VR")
println(io, "VI = $VI")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1098 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mc01od(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 10
REZ = Array{Float64,1}(undef, KMAX)
IMZ = Array{Float64,1}(undef, KMAX)
REP = Array{Float64,1}(undef, KMAX+1)
IMP = Array{Float64,1}(undef, KMAX+1)
DWORK = Array{Float64,1}(undef, 2*KMAX+2)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
K = parse(BlasInt, vs[1])
if ( K<0 || K>KMAX )
@error "Illegal K=$K"
end
vs = String[]
_isz,_jsz = (K,2)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
REZ[i],IMZ[i] = parsex.(Float64, vs[2i-1:2i])
end
close(f)
# interp call 1
INFO = SLICOT.mc01od!(K, REZ, IMZ, REP, IMP)
@test INFO == 0
INFO == 0 || return
# unable to translate write loop:
# write , REP(I+1), IMP(I+1), I = 0,K
# interp output 1
println(io, "P:")
show(io, "text/plain", REP[1:K+1]+im*IMP[1:K+1])
println(io)
end # run_mc01od()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 934 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mc01pd(datfile, io=stdout)
NIN = 5
NOUT = 6
KMAX = 10
REZ = Array{Float64,1}(undef, KMAX)
IMZ = Array{Float64,1}(undef, KMAX)
P = Array{Float64,1}(undef, KMAX+1)
DWORK = Array{Float64,1}(undef, KMAX+1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
K = parse(BlasInt, vs[1])
if ( K<0 || K>KMAX )
@error "Illegal K=$K"
end
vs = String[]
_isz,_jsz = (K,2)
while length(vs) < _isz*_jsz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
for i in 1:_isz
REZ[i],IMZ[i] = parsex.(Float64, vs[2i-1:2i])
end
close(f)
# interp call 1
INFO = SLICOT.mc01pd!(K, REZ, IMZ, P)
@test INFO == 0
INFO == 0 || return
println(io, "P:")
show(io, "text/plain", P[1:K+1])
println(io)
end # run_mc01pd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1668 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mc01qd(datfile, io=stdout)
NIN = 5
NOUT = 6
DAMAX = 10
DBMAX = 10
A = Array{Float64,1}(undef, DAMAX+1)
B = Array{Float64,1}(undef, DBMAX+1)
RQ = Array{Float64,1}(undef, DAMAX+1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
DA = parse(BlasInt, vs[1])
if ( DA<=-2 || DA>DAMAX )
@error "Illegal DA=$DA"
end
vs = String[]
_isz = DA+1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
A[1:_isz] .= parsex.(Float64, vs)
vs = split(readline(f))
DB = parse(BlasInt, vs[1])
DBB = DB
if ( DB<=-1 || DB>DBMAX )
@error "Illegal DB=$DB"
end
vs = String[]
_isz = DB+1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
B[1:_isz] .= parsex.(Float64, vs)
close(f)
# interp call 1
DB, INFO, IWARN = SLICOT.mc01qd!(DA, DB, A, B, RQ)
println(io, "DB = $DB")
@test INFO == 0
INFO == 0 || return
println(io, "IWARN = $IWARN")
if ( IWARN!=0 )
println(io, "degree reduced from $DBB to $DB")
end # if
DQ = DA - DB
DR = DB - 1
IMAX = DQ
if DR > IMAX
IMAX = DR
end
println(io, "polynomials (power Q-coefft R-coefft):")
for i in 0:IMAX
if ( i<=DQ && i <=DR )
println(io, "$i $(RQ[DB+i+1]) $(RQ[i+1])")
elseif ( i<=DQ )
println(io, "$i $(RQ[DB+i+1])")
else
println(io, "$i $(RQ[i+1])")
end # if
end
end # run_mc01qd()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1651 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mc01rd(datfile, io=stdout)
NIN = 5
NOUT = 6
DP1MAX = 10
DP2MAX = 10
DP3MAX = 10
LENP3 = max(DP1MAX+DP2MAX,DP3MAX)+1
P1 = Array{Float64,1}(undef, DP1MAX+1)
P2 = Array{Float64,1}(undef, DP2MAX+1)
P3 = Array{Float64,1}(undef, DP1MAX+DP2MAX+DP3MAX+1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
DP1 = parse(BlasInt, vs[1])
if ( DP1<=-2 || DP1>DP1MAX )
else
vs = String[]
_isz = DP1+1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
P1[1:_isz] .= parsex.(Float64, vs)
vs = split(readline(f))
DP2 = parse(BlasInt, vs[1])
if ( DP2<=-2 || DP2>DP2MAX )
else
vs = String[]
_isz = DP2+1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
P2[1:_isz] .= parsex.(Float64, vs)
vs = split(readline(f))
DP3 = parse(BlasInt, vs[1])
if ( DP3<=-2 || DP3>DP3MAX )
else
vs = String[]
_isz = DP3+1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
P3[1:_isz] .= parsex.(Float64, vs)
end # if
vs = split(readline(f))
ALPHA = parse(Float64, replace(vs[1],'D'=>'E'))
# interp call 1
DP3, INFO = SLICOT.mc01rd!(DP1, DP2, DP3, ALPHA, P1, P2, P3)
println(io, "DP3 = $DP3")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
if ( DP3>=0 )
end # if
end # if
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 959 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mc01sd(datfile, io=stdout)
NIN = 5
NOUT = 6
DPMAX = 10
P = Array{Float64,1}(undef, DPMAX+1)
MANT = Array{Float64,1}(undef, DPMAX+1)
E = Array{BlasInt,1}(undef, DPMAX+1)
IWORK = Array{BlasInt,1}(undef, DPMAX+1)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
DP = parse(BlasInt, vs[1])
if ( DP<=-1 || DP>DPMAX )
else
vs = String[]
_isz = DP+1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
P[1:_isz] .= parsex.(Float64, vs)
# interp call 1
S, T, INFO = SLICOT.mc01sd!(DP, P, MANT, E)
println(io, "S = $S")
println(io, "T = $T")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
BETA = 2.0
end # if
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 1152 | # Portions translated from SLICOT-Reference distribution
# Copyright (c) 2002-2020 NICONET e.V.
function run_mc01td(datfile, io=stdout)
NIN = 5
NOUT = 6
DPMAX = 10
P = Array{Float64,1}(undef, DPMAX+1)
DWORK = Array{Float64,1}(undef, 2*DPMAX+2)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
DP = parse(BlasInt, vs[1])
DICO = vs[2][1]
if ( DP<=-1 || DP>DPMAX )
@error "Illegal DP=$DP"
end
DPP = DP
vs = String[]
_isz = DP+1
while length(vs) < _isz
append!(vs, replace.(split(readline(f)),'D'=>'E'))
end
P[1:_isz] .= parsex.(Float64, vs)
close(f)
# interp call 1
DP, STABLE, NZ, INFO, IWARN = SLICOT.mc01td!(DICO, DP, P)
@test INFO == 0
INFO == 0 || return
println(io, "DP = $DP")
println(io, "STABLE = $STABLE")
println(io, "NZ = $NZ")
if ( IWARN!=0 )
@warn "mc01td returned IWARN=$IWARN"
return
end # if
stable = Bool(STABLE)
if ( stable )
println(io, "P is stable")
else
println(io, "P is unstable")
println(io, "unstable zeros: $NZ")
end
end # run_mc01td()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
|
[
"MIT",
"BSD-3-Clause"
] | 0.1.0 | 6521428e41ae0924b30460ef1ffada3b07ab2bc1 | code | 719 | # Julia code
# Copyright (c) 2022 the SLICOTMath.jl developers
# Portions extracted from SLICOT-Reference distribution:
# Copyright (c) 2002-2020 NICONET e.V.
function run_mc01vd(datfile, io=stdout)
f = open(datfile,"r")
readline(f)
vs = split(readline(f))
A = parse(Float64, replace(vs[1],'D'=>'E'))
B = parse(Float64, replace(vs[2],'D'=>'E'))
C = parse(Float64, replace(vs[3],'D'=>'E'))
# interp call 1
Z1RE, Z1IM, Z2RE, Z2IM, INFO = SLICOT.mc01vd!(A, B, C)
println(io, "Z1RE = $Z1RE")
println(io, "Z1IM = $Z1IM")
println(io, "Z2RE = $Z2RE")
println(io, "Z2IM = $Z2IM")
@test INFO == 0
INFO == 0 || return
if ( INFO!=0 )
else
end # if
close(f)
end # run_X()
| SLICOTMath | https://github.com/RalphAS/SLICOTMath.jl.git |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.